lilypond-devel
[Top][All Lists]
Advanced

[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 13:46:18 +0000

On 2015/10/30 13:20:35, benko.pal wrote:
sorry to chime in that late, but:
am I right that the problem is that we get the rotation matrix
cos a   -sin a
sin a    cos a
inexact?  and if so, how the inexactness is present?  one of the
diagonals is
exactly +/-1 while the other is not exactly 0?
in that case I'd suggest (would have suggested) to perform a paranoid
normalization of the (cos a, sin a) vector, which e.g. normalizes (1,
1e-9) into
(1, 0).

cos x = 1 - x^2/2 + ...

So basically this "paranoid normalization" would suppress all low values
for approximately |x| < sqrt (2 ulp) where "ulp" is the relative
precision of our floats.

So that looks like quite a noticeable cutoff relying on numerics.  The
advantage would be that the code is simpler, but once the code gets out
of the clamped-down region, the precision would not be better.

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

https://codereview.appspot.com/269530043/



reply via email to

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