error adding 0.1



On 11/23/2012 02:20 PM, Antonio Lapira wrote:
> If I try to do:
> (%i10) 1000!+1;
> it works, while if I try this, I get an error message,
>
> (%i10) 1000!+0.1;
With the Lisp flavor that I'm using (SBCL) the error message tells you 
better what the problem is:

    Too large to be represented as a DOUBLE-FLOAT

You're trying to add an integer to a double-float, which forces the 
large integer to be converted into a double float. The solution would be 
to use bigfloats or rational numbers, depending on what you are doing,
   1000!+0.1b0;
or
   1000!+rat(0.1);
or even
   1000!+rationalize(0.1);

See:  ? bfloat, ? rat, ? rationalize

Jaime