ELSEIF
Your brief EB
373 stories from 115 feeds 432 clusters Refreshed 3 minutes ago next pull 04:07

TECH Signal 490

Using turns instead of radians for trig calls removes pi/tau and improves precision

Casey Muratori argues that parameterizing angles in turns (0 to 1) instead of radians simplifies code, removes spurious pi/tau multiplications, and represents common angles exactly.

WHY IT MATTERS

Adopting turns in your math library can reduce unnecessary multiplications and improve precision for common angles like 90 degrees (0.25). It also simplifies the mental model for periodic values already in [0,1]. However, it requires changing your sin/cos implementations and any code that expects radians.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

The article claims that most code multiplies by pi or tau to convert to radians, and the trig library immediately divides by pi, so the conversion is wasteful.

02

Using turns (0 to 1) makes common angles like 90 degrees (0.25) exactly representable, unlike radians.

03

The switch is easy: just change sin and cos to take turns instead of radians, eliminating pi and tau from the codebase.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
computerenhance.com via Hacker News Turns are Better than Radians Open ↗