Floating number output



Thank you, Richard!

I understand  issue with representation of binary floating point number.

But if we use command

(float (/ 1 1000000))

in CLISP, for example,

then we have exact result 1.0E-6.

Command (lisp::float (/ 1 1000000)) returns result 1.0f-6.

Is it special post-processing of such kind of numbers?

2010/2/24 Richard Fateman <fateman at cs.berkeley.edu>

> 1/10  is not representable exactly as a binary floating point number of
> finite precision.
>
> If you insist on requiring 1/10, 1/100   etc be exactly represented, then
> you might consider
> using rational fractions, not floats.
>
> This is true in any binary floating-point computer arithmetic system, not
> just Maxima.
>
> RJF
>
> primus wrote:
>
>> Hi.
>> Thank you for attention to my message.
>>
>> If we use conversion to floating point then in some cases for expression
>> of kind 1/10^n, n-natural number,  result is not strict:
>>
>> fpprec:16;
>>
>> (%i84) float(1/10);
>> (%o84) 0.1
>> *(%i90) float(1/1000000);
>> (%o90) 9.999999999999999E-7*
>> *(*
>>
> *... snip..*
>



-- 
? ?????????,
?????? ?????????

???????? Nigma.ru