error adding 0.1



Sorry, that was an incomplete answer.  If you really want all the digits,
you'll need to set fpprec (floating-point precision) to the right number of
digits.

Example:

bfloat(log(1000!)/log(10)) => 2.567...b3

fpprec:2570;           (give a few extra digits)

1000! + 0.1b0 =>

4.0238...00001b2567

Note that the result is given in scientific notation.  I don't think
there's any way to force Maxima to print this as 40238...0000.1, but you
can certainly write a function to do this yourself.

              -s


On Fri, Nov 23, 2012 at 9:42 AM, Stavros Macrakis <macrakis at alum.mit.edu>wrote:

> As Jaime says, you can do this with bfloats, e.g. 1000! + 0.1b0
>
> On Fri, Nov 23, 2012 at 9:41 AM, Antonio Lapira <antoniolapira at yahoo.it>wrote:
>
>> so, can't I get the whole number ending with ........0000000000000.1 ?
>>
>>
>> --- Ven 23/11/12, Jaime Villate <villate at fe.up.pt> ha scritto:
>>
>> > Da: Jaime Villate <villate at fe.up.pt>
>> > Oggetto: Re: [Maxima] error adding 0.1
>> > A: "Antonio Lapira" <antoniolapira at yahoo.it>
>> > Cc: maxima at math.utexas.edu
>> > Data: Venerd? 23 novembre 2012, 14:34
>> > 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
>> >
>> >
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>