HN Debrief

Turns are Better than Radians (2022)

  • Programming
  • Developer Tools
  • Mathematics
  • Graphics
  • Infrastructure

The post argues that turns are often a better programming representation for angles than radians. In a turn-based system, 1.0 means a full rotation and simple fractions like 0.25 line up exactly with quarter turns. That matches a lot of real code better than radians do, especially when the job is to store an orientation, advance a phase, wrap values mod one revolution, or call trig functions numerically. Several people noted that this is already how many trig implementations effectively think internally after range reduction, so direct turn-based functions like sinpi or full-turn variants can avoid extra multiplies and some rounding noise.

If your code mostly stores, wraps, and compares angles, phases, or periodic positions, a turn-based API can reduce conversions and make fixed-point representations cleaner. Keep the underlying math in radians when you need derivatives, optimization, symbolic formulas, or to match published algorithms, and convert at the boundary.

Discussion mood

Interested but skeptical. People liked turns as a practical coding trick for graphics, DSP-style phase work, and old-school fixed-point systems, but most rejected the headline-level claim because radians remain the natural unit for calculus, series expansions, and complex-number identities.

Key insights

  1. 01

    Standard libraries are already moving here

    The practical version of the idea is not hypothetical. C23 and Fortran 2023 add functions like sinpi, cospi, atanpi, and friends, which take angles scaled by π or half-turns instead of plain radians. That matters because the library can do argument reduction directly in the scaled domain and avoid some of the accuracy loss and wasted work from multiplying by π before the call. This reframes the proposal as an API design issue, not a crusade to rewrite trigonometry.

    Check whether your toolchain already exposes sinpi or cospi style functions before building wrappers. If you maintain numeric libraries, adding scaled-angle entry points is a concrete improvement that does not force a unit fight across the rest of the codebase.

      Attribution:
    • jcranmer #1 #2
    • theodorethomas #1
    • andrepd #1
  2. 02

    Turns fit fixed-point and modular arithmetic unusually well

    Turns map cleanly onto unsigned integers in a way radians never will. With an 8-bit or 16-bit value, overflow naturally wraps around the circle, quarter turns land on exact bit patterns, and multiplying by small integers preserves the modular structure you actually want for oscillators, sprite headings, and old game-style rotation tables. Several people pointed out this is an old trick, often called BRAD, and it is more than nostalgia because it gives uniform precision and free wraparound semantics.

    If you have tight loops, serialization needs, or deterministic simulation constraints, consider representing angles as fixed-point turns instead of floats. You get simpler wrap logic and exact canonical directions without special cases.

      Attribution:
    • mlyle #1
    • jpopesculian #1
    • VonTum #1
    • aldonius #1
    • djmips #1
    • trklausss #1
  3. 03

    Skip scalar angles and store rotation state

    A stronger optimization than changing angle units is to avoid angle-to-trig conversion altogether. Storing rotations as a sin and cos pair, or sometimes as tan of the half-angle via stereographic projection, lets code compose rotations and project directions with rational operations and occasional normalization instead of repeated trig calls. That shifts the problem away from radians versus turns and toward representations that are better matched to the operations you actually perform.

    Profile whether your code really needs scalar angles. If most work is composing, interpolating, or serializing orientations, a pair representation or half-angle form can cut trig calls more than any unit switch will.

      Attribution:
    • srean #1
    • jacobolus #1
  4. 04

    Compilers will not usually erase the conversions

    Several commenters checked the obvious escape hatch and found it mostly does not exist. Because floating-point algebra is not freely rewritable under normal rules, and because trig calls live behind opaque library boundaries, compilers generally cannot simplify a multiply-by-π followed by a trig implementation that effectively rescales again. You need fast-math style assumptions, visible library internals, or dedicated sinpi and cospi functions to get the optimization safely.

    Do not assume the compiler will clean up redundant angle conversions in performance-sensitive code. If this matters, inspect generated code or use library functions that encode the intended scaling explicitly.

      Attribution:
    • eru #1
    • jcranmer #1
    • cbondurant #1
    • aerzen #1
  5. 05

    Series expansions and autodiff keep radians sticky

    The mathematical objection was not abstract purism. People doing numerical optimization, minimax polynomial implementations, and automatic differentiation said radians keep local approximations and derivative formulas clean. If you represent angles in turns, every small-angle expansion and gradient picks up explicit 2π factors. That means turns are awkward not only for symbolic calculus, but also for the very numerical code paths people use to make trig fast or differentiable.

    If your stack includes autodiff, optimization, or custom approximations near zero, stick with radians internally even if your external API uses turns. The conversion cost is easier to manage than contaminating every derivative and approximation with extra scale factors.

      Attribution:
    • WCSTombs #1 #2
    • cryo32 #1
    • cyberax #1

Against the grain

  1. 01

    Many application programmers never pay the calculus cost

    For a lot of software, especially straightforward rendering or graphing code, nobody is hand-coding derivatives or manipulating symbolic identities. In that world, internal turns are just another unit conversion layer, like screen pixels versus world coordinates, and the user never has to see it. This pushes back on the idea that elegant calculus identities should decide the representation for code that only needs numeric trig outputs.

    Be honest about your workload. If your code only evaluates trig numerically and never differentiates it, optimizing for representation and API clarity can be the right call.

      Attribution:
    • dhosek #1 #2
  2. 02

    Radians were never the only practical computation unit

    One historical counterpoint was that practical astronomy, surveying, and geodesy long used degree-like or cycle-based conventions for numerical work, while radians rose because they simplify symbolic manipulation. That does not make radians wrong, but it undercuts the claim that real-world computation naturally belongs to radians. The sharper conclusion is that symbolic math and numeric practice have often wanted different things.

    Do not treat historical convention as proof that one unit is universally best. Separate the needs of derivations, published formulas, and machine computation before standardizing on an angle representation.

      Attribution:
    • adrian_b #1
    • jacobolus #1

In plain english

API
Application Programming Interface, a defined way for software to expose functions or data to other software.
argument reduction
The process of transforming a trig input angle into an equivalent angle in a smaller range so the function can be approximated accurately.
BRAD
Binary Radian, an angle representation that maps a full turn onto an integer range so wraparound comes from integer overflow.
C23
The 2023 version of the C programming language standard.
complex analysis
The branch of mathematics that studies functions of complex numbers and relies heavily on properties of exponentials and trig functions.
cospi
A trig function that computes cos(πx) directly, often with better accuracy than multiplying by π and calling cos.
Euler’s formula
The identity e^(ix) = cos(x) + i sin(x), which connects exponentials, trigonometry, and complex numbers when x is measured in radians.
fast-math
Compiler settings that allow algebraic simplifications of floating-point code even when they may slightly change numerical results.
fixed-point
A numeric representation that stores values as scaled integers instead of floating-point numbers.
Fortran 2023
The 2023 revision of the Fortran programming language standard.
geodesy
The science of measuring the shape of the Earth and positions on it.
minimax polynomial
A polynomial chosen to minimize the maximum approximation error over an interval, commonly used in math libraries.
sinpi
A trig function that computes sin(πx) directly, often with better accuracy than multiplying by π and calling sin.
stereographic projection
A way to map points on a circle or sphere to a line or plane, used here to represent an angle by tan of half the angle.

Reference links

Language and library support

Angle representations and related resources

Units and dimensional analysis

Geodesy and historical math context