Yes, it is correct---I made a mistake. Sorry for the noise.
Barton
Raymond Toy <raymond.toy at stericsson.com> wrote on 05/04/2009 10:42:53 AM:
> [image removed]
>
> Re: [Maxima] big float to float conversion
>
> Raymond Toy
>
> to:
>
> Barton Willis
>
> 05/04/2009 10:42 AM
>
> Cc:
>
> "maxima"
>
> >>>>> "Barton" == Barton Willis <willisb at unk.edu> writes:
>
> Barton> (%i12) fpprec : 50$
> Barton> (%i13) x : 1.8514804991703517693765213431502813b-7;
> Barton> (%o13) 1.8514804991703517693765213431502813b-7
>
> Barton> Convert x to a double. Shouldn't this be
1.8514804991703518*10^-7
> Barton> (last digit is wrong)>
>
> Barton> (%i14) y : float(x);
> Barton> (%o14) 1.8514804991703517*10^-7
>
> I think this is ok. If we look at the bits of x and y:
>
> (%i4) :lisp (write (second $x) :base 2)
> 11000110110011010001101111000010011101010111110010111.
>
01010011100110011101101111000111100000011011111100001100100001001111011010101011101001100100101000100001100000000011
>
> (%i4) :lisp (write (integer-decode-float $y) :base 2)
> 11000110110011010001101111000010011101010111110010111
>
> (I've put a point at the trailing bits of x to make it a little
> clearer).
>
> We see that the top 53 bits of x and y match, and the remaining bits
> of x are less than half (doesn't start with a 1 bit), so it seems
> correct to me. (Easiest to see if you have a fixed width font to
> display this message.)
>
> Ray