the decimal to binary conversion of 2.718 is being done
so that the result is NOT 2718/1000, but another number close to
that. Note that 1/1000 cannot be represented in binary exactly.
You are being confused by the printing routine which rounds the
result to 2.718.
This behavior may be surprising to you, but I think it is correct
according to common lisp semantics.
RJF
Ken-ichi Noguchi wrote:
>Hello
>
>
>
>>test integer-decode-float on NaN, Infinity, etc.
>>before you decide your program is correct. I think that
>>such non-numbers should be "bigfloated" into symbols / gensyms
>>with appropriate properties.
>>e.g. NaN - NaN = NaN (not 0).
>>Complicates matters!
>>RJF
>>
>>
>
>I tried next example on Maxima,
>(C1) fpprec : 50;
>(D1) 50
>(C2)
>float(120938498304852938452489509485245834985034541)-bfloat(1209384983048529
>38452489509485245834985034541);
>Warning: Float to bigfloat conversion of 1.2093849830485294E44
>(D2) 3.772935106511773832671833299B27
>I made sure of the problem in converting big number.
>In addition, on common-lisp, I did the function (rational).
>(rational 2.718)
>5700059/2097152
>But 5700059/2097152 isn't 2.718, I hope 2718/1000 or 1359/5000(reduce a
>fraction). I think now we will face these problems of converting big
>numbers, ex. in case of investigating the number of molecule, atom etc..
>
>Ken
>
>
>_______________________________________________
>Maxima mailing list
>Maxima@www.math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>
>