[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modify coord-rotate to get exact values for (sin PI) etc (issue 2695

From: dak
Subject: Re: modify coord-rotate to get exact values for (sin PI) etc (issue 269530043 by address@hidden)
Date: Fri, 30 Oct 2015 15:32:45 +0000

On 2015/10/30 15:07:42, benko.pal wrote:
2015-10-30 14:46 GMT+01:00  <mailto:address@hidden>:

> I really think we should move everything to degrees except for the
> calculations.

I'm not against that, but don't really know what are the final

I'd argue for creating functions sind, cosd, angle in analogy to
METAFONT's functions.  And we'd use them exclusively so it might make
some sense to define C++ versions of them and export them in order to
get consistent results.

They'd map everything to small degree angles before converting to/from

compute each (co)sine by checking first whether the
argument is an integer multiple of 90°?

If you fold every operation to +/- 45 degrees before going to radians,
you don't need to check anything.  Multiples of 90 are perfectly
representable in degrees.

or to review all our
calculations and reformulate so that each has at most one sin/cos/atan
computation?  does the problem come from functions in a "too" modular
hierarchy calling each other, converting between angles and sines back
and forth?

No, it comes from pi/4 and its multiples not being representable in our
floating point arithmetic.

or would simply clamping all (co)sines with absolute value
below sqrt (2 ulp) to zero solve the practical problems at hand?

It would hide the problem.  But you cannot, for example, check angles
for being straight, even if their whole history was straightforward.  If
we can't tell the computer what we want it to do in its own terms, there
are just no "trivial" transformations or manipulations.

And PostScript (and PDF and METAFONT) _do_ represent angles in degrees.
So it's sort of silly that we cannot get an angle of 180 degrees
straight into PostScript without change.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]