[cairo] Shouldn't Cairo use/offer degrees rather than radians?
Gregor Mückl
GregorMueckl at gmx.de
Tue Jul 11 04:10:28 UTC 2017
On 07/10/2017 10:04 PM, David Kastrup wrote:
> cecashon at aol.com writes:
>
>> Has anyone figured out a good explanation for this? I haven't been
>> able to figure it out. It looks like the problem is tied to only one
>> particular precision point. I don't know why that is. If I change the
>> size of the surface, radius, y-point or even pi I get the same problem
>> point. If I run with valgrind I get a different repetitive problem
>> point.
>
> Does valgrind link debug libraries in some manner?
>
No, valgrind emulates x86 completely in software. It does not load
different libraries, but may hook certain libc function calls to perform
its job.
>> Maybe on some hardware this doesn't happen?
>
> That's certainly quite likely since it depends on just what sin/cos do
> on a minuscule scale where different FPUs will quite likely deliver
> different results.
>
>> I am testing on a Intel 32 bit Atom CPU N270 1.60GHz × 2 with
>> Ubuntu16.04. This is my latest to try to figure out what is happening.
>
> Compilers may choose to use more floating point precision than specified
> for intermediate results. That means that different GCC versions and
> different optimization options might change values around.
>
> For that reason it's important that you don't link with any different
> libraries, even libraries compiled from the same source code.
>
Don't pin this only on the compiler, at least on x86. The old x87
compatible FPU instructions (obsolete in 64 bit mode) use internal
registers with significant longer mantissa than a double. The length of
the mantissa was not even fixed between implementations. However,
storing values from the FPU to memory results in truncation in this
case. This was "fixed" in SSE and newer intruction sets that are now
fixed at 32 bits for floats and 64 bits for doubles for internal registers.
I believe that this thread is starting to demonstrate that hunting for
numeric precision beyond a certain point using floating point arithmetic
is a fool's errand.
More information about the cairo
mailing list