[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: floats



     1. I do set *read-default-float-format* = double-float. The numbers 
     are still read as singles.
     2. ~// in format is a luxury. single+float=single is a *MAJOR* *bug*. 
     People who wrote ANSI CL standard are not idiots. They had something 
     in mind -- correct computations, to be sure. (I am trying hard to 
     contain my emotions. Sorry.) You are trading *correct* result for 
     pretty-looking result. This is unbelievable!!!!!!!!!!!!!!!
     To use your impnotes example: "(- (+ 1.7 pi) pi)  should not return  
     1.700000726342836417234L0,"  This 1.700000whatever is still 1.7, for 
     purposes of practical computations. But when I am getting *negative* 
     standard deviations, this is not correct in any possible sense!!!! 
     Single for 1.123 is OK, but when I take squares etc., it stops being 
     OK!! I know that and I want to use doubles because of that!
     You think that a float is always imprecise. You are *wrong*. 123456.7 
     is *precise*, and I should not have to use ratios to tell clisp that! 
     And if I want to compute the square, I want it to be precise too.
     Anyway, can you name another computer system where 
     single+double=single?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
     I just can't believe this could ever happen!
     I am sorry, it is kind of hard to remain calm when encountering 
     something like this.


______________________________ Reply Separator _________________________________
Subject: Re: floats
Author:  <clisp-list@ma2s2.mathematik.uni-karlsruhe.de> at INET
Date:    1997-11-19 22:42


Sam Steingold <sshteingold@cctrading.com> writes: 
> 
>      I am having a *very* nasty problem. I want all my floats to be double. 
>      Always. I set *default-float-format* to 'double-float, *and* set the 
>      vars as 0.0d0. And still end up with numbers like 644151.75f0.
     
When you read floats from files, you also need to have 
*read-default-float-format* = double-float.
     
>      This can be traced to 
>      
>      > (+ 0.0d0 1233456.2345f0)
>      
>      1233456.3f0
>      >
>      
>      which is quite outrageous, since *I* would expect it to be double on 
>      the grounds of double + single = double no matter what! :-)
     
This is a different issue: Once your data is already infected with 
single-floats, does this disease spread or not? In ANSI CL compliant 
systems, the double-floats take over again but inaccuracies spread
nevertheless under cover. In CLISP, with the rule "double + single = single", 
the single-floats spread, so it's easier for you to detect them.
     
For more explanations, see section 12.1. of 
ftp://ma2s2.mathematik.uni-karlsruhe.de/pub/lisp/clisp/impnotes.html
     
                           Bruno