|
 |
Cousin Ricky <ric### [at] yahoo com> wrote:
> On 2025-10-15 22:22 (-4), Bald Eagle wrote:
> >
> > It appears that at 90 degrees (pi/2), tan and sec do not equal Inf.
> > so
> > #declare csc = function (N) {select (sin(N), 1/sin(N), Inf, 1/sin(N))}
> > failed.
> > I had to test against 1E10.
>
> This isn't so much a bug as a floating point limitation. Pi/2 has no
> exact representation in binary, so you never get exactly 90 degrees.
I managed to code some macros for all of the trig functions that seems to work
well for increments as small as pi/180.
It seems to me that we ought to have code that works out of the box for at least
1-degree increments.
I'll have to look in the source code to see what we use to store the values - it
would probably be nice to use double or extended precision of some sort.
- BW
Post a reply to this message
|
 |