Re: Sine code for ANSI C
CBFalconer wrote:
(snip regarding sin() function)
[color=blue]
> And that problem is inherent. Adding precision bits for the
> reduction will not help, because the input value doesn't have
> them. It is the old problem of differences of similar sized
> quantities.[/color]
When I was in high school I knew someone with a brand
new HP-55 calculator. (You can figure out when that was
if you want.) He was so proud of it, and sure of the
answers it gave. For the sine (in degrees) of 9.999999999e99
it gave something like 0.53, which is obviously wrong
because 9.999999999e99 is a multiple of 180.
Yes, argument reduction is always a problem, because
people will expect it to be right, no matter how useless
the result is. It is a little easier in degrees than
in radians, yet few languages (PL/I being one) support
SIND() and such.
-- glen
CBFalconer wrote:
(snip regarding sin() function)
[color=blue]
> And that problem is inherent. Adding precision bits for the
> reduction will not help, because the input value doesn't have
> them. It is the old problem of differences of similar sized
> quantities.[/color]
When I was in high school I knew someone with a brand
new HP-55 calculator. (You can figure out when that was
if you want.) He was so proud of it, and sure of the
answers it gave. For the sine (in degrees) of 9.999999999e99
it gave something like 0.53, which is obviously wrong
because 9.999999999e99 is a multiple of 180.
Yes, argument reduction is always a problem, because
people will expect it to be right, no matter how useless
the result is. It is a little easier in degrees than
in radians, yet few languages (PL/I being one) support
SIND() and such.
-- glen
Comment