[GiNaC-list] Possible size issue in test in numeric.cpp

Chris Dams Chris.Dams at mi.infn.it
Mon Aug 7 15:25:29 CEST 2006


Dear Pierangelo,

On Sun, 6 Aug 2006, Pierangelo Masarati wrote:

> numeric.cpp:95: warning: comparison is always true due to limited range of 
> data type
> numeric.cpp:95: warning: comparison is always true due to limited range of 
> data type 
> 
> The constructor of "numeric" that takes an "int" as its argument "i" 
> performs the test 
> 
>        i < (1L << (cl_value_len-1)) 
> 
> My guess is that the test is incorrect on those architectures, but I
> admit I haven't investigated enough.

I'm not a CLN expert either, but to me it does not seem that the code is
incorrect. On the AMD 64 platform it is apparently always okay to apply
the constructor cl_I(int) no matter how large the integer argument is. If
the compiler is smart enough, it will automatically do what your patch is
doing (i.e., throw the if out of the code), so I fail to see benefits from
your patch.

Best wishes,
Chris



More information about the GiNaC-list mailing list