[CLN-list] Anomaly when integer zero combined with extended float.

Richard B. Kreckel kreckel at ginac.de
Wed Sep 6 22:23:13 CEST 2006


Hi!

Ray Buvel wrote:

> I ran across an anomaly in CLN that occurs when an integer zero value
> is combined with an extended precision floating point number.
> Consider the following
>
> cl_R a,b,r;
>
> Now assign a cl_I variable whose value is zero to a, and a high
> precision cl_LF value to b.  Then perform any of the following
> operations.
>
> r = a * b;
> r = b * a;
> r = a / b;
>
> In every case, the precision degrades to the default value.  However,
> if the integer value in a is anything other than zero, the result has
> the precision of b.
>
> Since this only occurs for multiply and divide, I suspect it may be
> due to some shortcut that is taken when one of the operands is zero.


What really happens is that CLN detects that the result is an exact zero 
and represents it exactly as an integer, not as a floating point number.

You may easily convince yourself about this by checking the return value 
of instanceof(r, cl_I_ring).

>
> P.S.  Is there another way to report anomalies other than posting to 
> the list?


No. I think a list is just fine as long as the amount of anomalies stays 
low.

Regards
  -richy.

-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>



More information about the CLN-list mailing list