(cos (scale-float 1d0 120)) incorrect

Raymond Toy <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Clisp 2.49 on a Linux Ubuntu box says:

[1]> (cos (scale-float 1d0 120))
1.0d0

The true answer is closer to -0.92.  Cmucl and ccl produce this
answer.  Maxima says this is the correct answer.

I think the issue is that pi reduction is not done to full precision.

Using long-floats, clisp still produces 1L0, but making
long-float-digits 128 gives the correct answer.

Note also that (scale-float 1d0 120) can be represented exactly as an
IEEE754 double precision value, and that IEEE754 doubles are not
approximations.  They are exact rationals (of a certain form).

Ray


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.