Douglas Crockford




2019 Appearances





How JavaScript Works



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   =  degree / 360  =  radian  / 2π
degree  =  cycle  * 360  =  radian  / 2π  * 360
radian  =  cycle  * 2π   =  degree  / 360 * 2π

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

I am thinking that 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. 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.