On 2015/10/30 15:07:42, benko.pal wrote:
2015-10-30 14:46 GMT+01:00 <mailto:[email protected]>:
> I really think we should move everything to degrees except for the
final
> calculations.
I'm not against that, but don't really know what are the final calculations.
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 radians.
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. https://codereview.appspot.com/269530043/ _______________________________________________ lilypond-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-devel
