[cairo] Shouldn't Cairo use/offer degrees rather than radians?

David Kastrup dak at gnu.org
Tue Jul 11 05:10:19 UTC 2017

Gregor M├╝ckl <GregorMueckl at gmx.de> writes:

> 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.

The proposed code for setting angles in degrees is numerically precise
at right angles for any floating point representation.

Stuff like M_PI/2 or even M_PI will always result in hunts for numeric
precision since pi does not have an exact floating point representation.

This thread was about a proposed user interface that makes hunting for
numeric precision a non-issue for the most prominent cases while
representing angles in a common human-accessible format that other
graphic systems and formats use as well.

So the conclusion "let's not bother offering something better because we
cannot conclusively figure out how bad the current situation is on
different systems respectively" is not really what I was pitching for.

David Kastrup

More information about the cairo mailing list