Douglas Crockford

Blog

Books

Videos

2020 Appearances

JavaScript

JSLint

JSON

Github

How JavaScript Works

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

jdb财神捕鱼单机版 浙江快乐12走势图一定牛 彩吧论坛首页一彩票论坛 北京快中彩追号计划 天津快乐十分中奖技巧有谁知道的呀 久其软件股票行情 新手去赌场怎么玩 急速赛车2 江苏11选5分布一定牛 股票涨跌原因分析 浙江十一选五开奖走势