On 12/11/2014 11:59 AM, Iago Toral wrote:
That said, I also noticed that most of the errors reported are for
fairly big numbers, so I played a bit with some examples and noticed
that trigonometric functions lose more precision as their argument gets
bigger. If I pass arguments of a few thousand radians to sin() or cos()
I usually get results that are off by >0.1 and for many values over
15000 radians I get completely bogus results, off by more than 0.5 of
even 1.0 in some cases. Some examples:
Angle in radians | sin() result | Expected | Error |
13000.0 | 0.05308(...) | 0.08947(...) | ~ 0.036 |
14000.0 | 0.85559(...) | 0.87388(...) | ~ 0.018 |
15000.0 | 0.00018(...) | 0.89324(...) | ~ 0.893 |
16000.0 | 0.82698(...) | 0.13100(...) | ~ 0.696 |
24500.0 | 0.00000(...) | 0.95833(...) | ~ 0.958 |
I suppose this is a known issue, right? Also, considering that sin() is
implemented as a single Math hardware instruction I imagine there is
little that software can do to correct this in any case...
According to the hw specs, sin and cos absolute error is <= 0.0008, but
only for the range of +/- 100 * pi.
--
Petri Latvala
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev