Douglas Crockford

Blog
Books
Videos
2025 Appearances
Slides
JavaScript
Misty
JSLint
JSON
Pronto
Github
Electric Communities
Flickr Photo Album
Blue Sky
LinkedIn
Mastodon/Layer8
ResearchGate
Pronouns: pe/per
Aptera
The best is yet to come
About

Cycles

Most people measure angles in degrees (0 ... 360). Most mathematicians measure angles in radians (0 ... ). But as a programmer, I think it is best to measure in cycles (0 ... 1). It is trivial to correct over-rotation (discard the integer part). It is trivial to find the quadrant (the two most significant bits). Table lookup implementations of sine are trivial as well.

All three units work, and each is easily convertible into the others.

cycle    =   radian / (2 * π)   =   degree / 360
degree   =   radian * 180 / π   =   cycle * 360
radian   =   degree * π / 180   =   cycle * 2 * π

When converting between radians and degrees, there is an implicit step where values are first converted to cycles.

Programming languages should make cycles the standard angular unit. It is the most convenient for programming. It is less baffling to normal people than radians. If you know how to give a dial a quarter turn, you understand cycles. Computers can express cycles exactly. Computers have trouble with π.

Mathematicians may still have reasons to prefer radians, but they are smart enough to know how to do the conversion if they have to.

Nions, Short Up Tack, and Complex Numbers
The Trouble With Trigonometry
Anonymization by Anonymouse.org ~ Adverts
Anonymouse better ad-free, faster and with encryption?
X