Dear Barton,
this isn't a problem of the fsin/fcos implementation. For calculating a sine function you need a certain absolute precision. E.g. if you want to have 2 decimals output precision, your number must have an absolute precision of 2 decimals. Floating point numbers have constant relative precision. So the larger the number gets, the worse the absolute precision becomes. If the absolute precision is worse than pi, the result is simply meaningless. Imagine you have the number 1000000000000 with error +-1000. The relative error is quite small (1ppb), but the absolute error is more than 100*pi. The result is meaningless.
I once did a floating point implementation which takes this into account, and simply gives you ? as result on such computations. It does this by not normalizing after subtractions, so that the mantissa contains information about the number of valid bits. This might be a nice thing to have in maxima as well. Instead of garbage numbers, return ?.
Best regards,
Michael
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Barton Willis
Sent: Thursday, May 10, 2012 4:36 PM
To: Raymond Toy
Cc: maxima at math.utexas.edu
Subject: Re: [Maxima] cos(1.0d97) with GCL, Clozure, and Julia
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.
--bw
>I suspect that the intel fsin (fcos?) instruction is not used. Any
>number above 2^63 (~ 1.8d19) is too large for that instruction and I
>think it just returns 0. (I think.)
>Ray
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima