On Thu, May 10, 2012 at 7:35 AM, Barton Willis <willisb at unk.edu> wrote:
> Thanks for the information. I didn't know that fsin/fcos only really work
> on numbers with magnitude less than about 2^63. What lead me to this
> experiment was the statement on the Julia Language page about numerical
> accuracy (second sentence on http://julialang.org/). I suppose Maxima's
> numerical sine, cosine, and ... could look for out for binary64 inputs
> outside +/- 2^63.
>
>
The instruction accepts any floating-point number and returns something.
And actually it's worse than that. Since the fpu only has about 66 bits of
pi, range reduction of 2^63 leaves only about 2-3 bits left, which just
gives you a value of sin accurate to the nearest octant or so.
Contrast this with Sun's libm (which might also be used in glibc sse). It
has 1100 or so bits of pi so range reduction will still produce 53 bits of
accuracy so the computed value has full precision.
I don't have gcl around, but it might be informative to see what gcl
returns for (integer-decode-float 1d97) versus what ccl or cmucl returns
for (integer-decode-float 1d97). (Both return 5271098971615262, 270, 1.)
Ray