Sep 26, 2022Liked by Casey Muratori

Just keep in mind, though, that all those formulas of derivatives and primitives of trig functions in standard calculus books assume that arguments are expressed in radians. Say, the derivative of sin x w.r.t. x is cos x --- that is only true if x is in radians. Otherwise, you would get an extra factor, due to the chain rule. So, if the mathematical expression you are working with happens to come, somehow, from derivatives or primitives, chances are that you will miss those extra factors, by simply deleting every ocurrence of pi or tau.

Expand full comment

pico-8 does it this way: https://pico-8.fandom.com/wiki/Cos

Expand full comment

If we don't care about legacy then we don't need to call them cos and sin either, right? Maybe call these new functions turnX and turnY?

Expand full comment
Sep 27, 2022·edited Sep 27, 2022

Have you ever heard of Rational Trigonometry? It doesn't use angles or turns, but instead uses spread. I've always wondered how a game engine would look like if it used those primitives.


Expand full comment

In the AVX exapmle, I don't understand why sin(x) is equals to 4 / PI * x? If x equals to TAU then wouldn't the function return 8?

Expand full comment

I totally thought this article was going to be something about inductors

Nice article! GLSL/HLSL should provide a turn version of trig funcs

Expand full comment

Just mentioning that we ALREADY do that for exp() and log(), having multiple variants (base-e, base-10 and base-2) in the same lib, makes me wonder why we still don't have ""base-1"" and ""base-tau"" trig alongside the regular ""base-pi"" trig in so many libs.

Expand full comment

This reminds me of the utopian 'gradians' button (technically DRG) I see on calculators and always wish we could switch to.

Expand full comment

If I understand the suggestion correctly, this wasn't overlooked, it was suggested here for instance:

http://thomascool.eu/Papers/Math/TrigRerigged.pdf "Abstract: Didactic issues in trigonometry concern the opaque names of sine and cosine and the cluttering of questions with p or 360 whereas a simple 1 suffices. (Linked from here: https://en.wikipedia.org/wiki/Turn_(angle) )

Astronomer Fred Hoyle proposed a decimal system with "milliturns". :-)

However, computing essentially re-parametrized basic functions (X(t), Y(t)) = (cos 2pi t, sin 2pi t) instead of (cos t, sin t) that was suggested there, and seems to be the suggestion here too, might be natural "conceptually" (that's the point of tau and the manifesto, to use fractions of the whole circle rather than half as reference), but computationally they are not friendly.

A great (definitive) recent book on mathematical function computation is:


"Nelson H.F. Beebe The Mathematical-Function Computation Handbook"

The beauty of the existing functions (and radian measure) is that they are arc-length or "unit speed" parametrizations of the circle, so as someone else pointed out, all of the series coefficients are 1, 0, -1, 0, and many other computational conveniences and mathematical relationships would be lost.

The circle constant 6.28... was never proposed for computational considerations, but for mathematical conceptual ones, to make the parametrization portions of 1 rather than of 2.

So that a quarter turn replaces "pi over 2" for what every child gets is a quarter of an hour.

Of the videos, Phil Moriarty's Numberphile segment.


is probably the best at explaining the point. He has a great fun book on quantum mechanics too: https://www.goodreads.com/en/book/show/34196224

Expand full comment
Sep 28, 2022·edited Sep 28, 2022

Is there any good C/C++ (preferably single header) math library out there that does this? Or do I have to roll my own?

(Took a look at avx_mathfun.h for something to start with maybe, but want non-SIMD as well.)

Expand full comment

You consider turns where a full circle is [0,1] or half turns, where a full circle is [0, 2].

How about full turns where a full turn is [0,360] and half turns are [0,180]?

Expand full comment

For speed: use a (limited term) Taylor series.

MUCH faster.

Expand full comment

Of course !!, all the code is faster, my math lib using this.


Expand full comment

Yes, turns are better than radians in many cases. But in a lot of those cases degrees are even better. 360 is a superior highly composite number (https://en.wikipedia.org/wiki/Superior_highly_composite_number) and we can get exact representations for many more common and useful angles than with turns. Want to split a circle into 6 equal parts? 1/6 doesn't have exact representation in float. 360/6 is not only exact in float32 but also an integer.

Expand full comment

Thanks, man. I learned a few things here.

Expand full comment

ty casey

Expand full comment