Mechanism · a hard thing done with only shift, add, and a sign
The Sine That Never Multiplied
A pocket calculator can find the sine of an angle with a CORDIC core that needs no general hardware multiplier. It walks a single vector through a fixed ladder of ever-halving angles — arctan 1, arctan ½, arctan ¼ — and at each rung it does only three things a chip finds trivial: shift some bits, add, and choose a sign. That is CORDIC. Watch it work, watch why its magic constant never changes, then flip one parameter and turn the same machine into a circle, a straight line, or a hyperbola.
In 1959 Jack Volder needed to compute trigonometry aboard a B-58 bomber, in real time, with 1950s hardware that had no multiplier worth the name — just shifters and adders. His answer, the COordinate Rotation DIgital Computer, is still how a great deal of silicon computes sines today. The idea is almost impudent: to rotate a vector by some target angle θ, don't rotate it by θ. Rotate it by arctan 1 = 45°. Overshot? Rotate back by arctan ½ ≈ 26.57°. Still not there? Forward by arctan ¼ ≈ 14.04°. Each rung is half-ish the last, so the running total zeroes in on θ like a scale balancing — a binary search across the arc.
The reason those particular angles were chosen — the arctangents of 2⁻ⁱ — is the whole trick. Rotating by an angle whose tangent is exactly 2⁻ⁱ means the rotation's arithmetic collapses into a bit-shift. A true rotation multiplies by a 2×2 matrix full of sines and cosines. CORDIC's rotation multiplies by 2⁻ⁱ, which shifts the digits i places right relative to a fixed binary point. The instruction "move the point i places right." reverses the direction: the point moves left relative to the digits. No multiplier required.
§1 · The ladder
A fixed table of angles, computed once
Every CORDIC machine carries one small read-only table: the arctangents of the negative powers of two. Here are the first rungs (recomputed live, below), beside the length each rung stretches the vector — hold onto that second column, it is the secret of the whole method.
| i | 2⁻ⁱ (the shift) | αᵢ = arctan 2⁻ⁱ | αᵢ in degrees | scale sᵢ = √(1+2⁻²ⁱ) |
|---|
Add every rung and you get the farthest angle a bare CORDIC can reach: Σ arctan 2⁻ⁱ = 1.743 rad ≈ 99.88°. Ask for more than that and you must first fold the angle into a quadrant (the calculator does; our instrument stays inside the honest range). Now let it run.
§2 · The instrument
Watch one vector zig-zag onto the circle
Set a target angle. The vector starts pointing along the x-axis, at a peculiar length K = 0.6073… we will explain in a moment. Then it takes N pseudo-rotations, each time turning toward θ if it is short of it, away if it has overshot — the + and − choices below. After enough steps the tip lands, to full precision, on the unit circle at exactly (cos θ, sin θ). No sine was ever looked up; it fell out of the rotations.
Native CORDIC reaches ±99.88°. Beyond that a real chip folds by quadrant first.
Accuracy improves by about one bit per step on average. Drag to compare iteration counts.
CORDIC cos θ / sin θ
0.7660 / 0.6428
from shifts & adds only
Math.cos / Math.sin
0.7660 / 0.6428
the library's answer
|error| (max of the two)
1.2e-4
≈ 13 correct bits
the sign choices dᵢ — turn toward θ (+) or back (−)
That is the entire algorithm. Three integer operations per step — a shift, an add or subtract, and reading one sign bit — repeated a couple of dozen times. Nothing that deserves to be called a multiply. But two things should nag: why does the vector start at that strange length K, and why does K never depend on the angle you asked for? That constant is doing something, and it is the hinge the whole method turns on.
§3 · The payload
Why the gain K never changes
Here is the sleight of hand. A true rotation by angle α keeps the vector's length exactly the same. CORDIC's step does not. When it "rotates" by using tan α = 2⁻ⁱ, it quietly skips the cos α that a real rotation carries — so each step is a rotation and a stretch. This is why it is called a pseudo-rotation. The step is:
yi+1 = yi + d·xi·2⁻ⁱ
Ask how much longer the vector got. Square the new length and expand — this is the one calculation that matters on this whole page:
= x² − 2·d·x·y·2⁻ⁱ + y²·2⁻²ⁱ + y² + 2·d·x·y·2⁻ⁱ + x²·2⁻²ⁱ
= (x² + y²)·(1 + 2⁻²ⁱ) # the two red terms cancel — for either sign of d
Look at what the sign d does and does not touch. It appears only in the two red cross-terms — and those are equal and opposite, so they cancel for d = +1 and for d = −1 alike (all that matters is d² = 1). What survives, the stretch factor √(1+2⁻²ⁱ), is set by the shift magnitude i alone. The sign steers the angle; it has no vote on the length.
So over N steps the vector's length is multiplied by the same product no matter what angle you steered toward — a fixed number. Its reciprocal is K. Start the vector at length K and the accumulated stretch lands it back at length exactly 1, on the unit circle, where its coordinates are the cosine and sine. Below: pick a rung i and a vector, and see the same stretch land the + step and the − step on the identical dashed circle — different directions, one radius.
The stretch is √(1+2⁻²ⁱ). Bigger i → tinier stretch, closer to a true rotation.
Any direction: the two tips always share one dashed circle. The sign never moves the radius.
stretch this rung sᵢ
1.1180
= √(1+2⁻²ⁱ)
length after + step
1.1180
|v| · sᵢ
length after − step
1.1180
identical → K is constant
And here is K assembling itself. The running product of the stretch factors converges to the total gain A = 1/K; its reciprocal settles onto the constant every CORDIC chip stores. Tied to the same iteration count N as the instrument above:
Converged, to the last bit a double can hold: K = 0.60725293500888, 1/K = 1.64676025812107. This single number is the price of admission, paid once, for every trig call the chip will ever make.
§4 · The error curve
One bit per step — until it isn't
The folklore says CORDIC gains "about one bit of accuracy per iteration," and the curve below shows the overall trend. It is not a promise of improvement at every step. At θ = 0.7 rad, the sine error against Math.sin is about 1.57×10⁻⁹ after 24 steps and 4.13×10⁻⁹ after 28. That bounce is not a double-precision floor: the same recurrence reaches about 1.07×10⁻¹² after 40 steps and 1.11×10⁻¹⁶ after 56. This plot stops at 28. Drag N to compare checkpoints.
| N | |sin error| | bits | vs. slope |
|---|
A bounce between checkpoints does not by itself identify a precision limit. A hardware designer reads this curve backwards: to guarantee b good bits, run about b iterations and store the table to a couple of guard bits beyond that. The cost is linear in the number of result bits — which, in a moment, is exactly why CORDIC lost the general-purpose CPU.
§5 · The flagship
One machine, three geometries
Everything so far was Volder's 1959 circular CORDIC. Twelve years later, John Walther at Hewlett-Packard noticed that the identical shift-add-sign iteration — change nothing but one sign in the update and swap the little angle table — computes an entire library of functions, not just sine. He added a single parameter m:
yi+1 = yi + d·xi·2⁻ⁱ
zi+1 = zi − d·αi # α from the table chosen by m
The quantity Q = x² + m·y² changes at each step according to Qi+1 = (1 + m·2⁻²ⁱ) Qi. With m = +1, the target after gain compensation is a circle: sine, cosine, arctangent. With m = 0, x stays fixed on a straight line, and the machine multiplies and divides. With m = −1, the target is a hyperbola, giving exp, ln, √, and the hyperbolic functions. The circular and hyperbolic intermediate points change scale as they turn. Same silicon. Flip m and watch the path approach a different target.
CORDIC result
—
same shift-add machine
Math library
—
the answer to beat
|error|
—
—
| i | d | x | y | z (angle left) |
|---|
The hyperbolic mode hides one genuine wrinkle, and the instrument honours it rather than fudging it: not every rung converges on the first pass. Iterations 4, 13, 40, 121, … (each 3k+1 after the last) must be repeated, or exp and ln silently drift. You can see the doubled rows in the trace table above when m = −1. That is the sort of detail a one-paragraph "CORDIC rotates a vector" tutorial never mentions — and the reason the verifier for this page tests convergence with and without the repeats.
This unification is the answer to the sophisticated dismissal — "CORDIC is a museum piece; real processors just evaluate polynomials." The depth of CORDIC was never the sine. It was that one tiny state machine, by swapping a table and a sign, spans trigonometry, exponentials, logarithms, multiplication, division and square roots. Which is why it never left the places where multipliers are expensive or absent: FPGAs and ASICs, DSP blocks, and dedicated units like the CORDIC coprocessor STMicroelectronics still ships inside its STM32 chips.
§6 · The relative
The other way to make a function cheap
There is a rival trick, and setting the two side by side sharpens what CORDIC is. In 1962 — three years after Volder — John Mitchell showed you can multiply and divide by faking a logarithm: because a binary number's position already is roughly its log₂, you can approximate the log by counting and shifting bits, add instead of multiply, then shift back. The most famous descendant of that idea is the fast inverse square root from Quake III: reinterpret a float's raw bits as an integer and you have log₂ for free, already sitting in the exponent field.
Both families make functions cheap, by different mechanisms: circular CORDIC builds sine from arctangent rotations, while inverse square root is algebraic. The bit-log trick supplies a single, one-shot initial guess: reinterpret the bits, then shift and subtract to seed the inverse square root, at a cost of a few percent of error. A Newton step refines that seed. CORDIC is iterative accumulation: it never reinterprets anything; it grinds out one more correct bit per rung by tabulated rotation, as accurate as you are patient. One reads a logarithm the hardware already wrote down; the other builds an answer up from rotations. Kin in spirit, opposite in method — which is why they win in different places.
The check — every number on this page, recomputed from the recurrences
verifier: 33 / 33 green
Nothing here is a stored answer. The browser runs the real CORDIC iterations live for the instruments above, and research/cordic/verify-cordic.mjs recomputes the same quantities independently — the gain, the ladders, the ranges, the error curve and its checkpoint rebound, and the linear and hyperbolic modes (including a control that shows the hyperbolic repeats are load-bearing). A sampling, computed just now in your browser:
Run it yourself: node research/cordic/verify-cordic.mjs → 33/33 PASS. Sources and the full check list live in research/cordic/.
What is exactly true here, what is idealised, and three things people get wrong
Exactly true. The gain K = 0.6072529350088813 is constant, and the reason is the cancellation shown in §3 — the per-step stretch √(1+2⁻²ⁱ) depends on the shift i only, never on the sign. Circular CORDIC converges for |θ| ≤ Σ arctan 2⁻ⁱ = 1.7433 rad ≈ 99.88°; the linear range is Σ 2⁻ⁱ = 2; the hyperbolic range is ≈ 1.1182 rad and needs the repeated iterations. All of this the verifier reproduces.
Idealised. Our instrument computes in the browser's float64, so the 28-step plot shows convergence in that arithmetic, with errors measured against the math library. A real fixed-point CORDIC carries quantisation error in its stored angle table and arithmetic; their word lengths limit the useful number of iterations.
"HP calculators used CORDIC." Nearly, not exactly. The HP-35 (1972) ran a CORDIC-family method — David Cochran's implementation used the Meggitt pseudo-multiplication/pseudo-division variant, and Jacques Laporte's reverse-engineering shows its exp/ln path differs from textbook circular CORDIC. So: CORDIC-family, yes; the precise rotation this instrument shows, not verbatim.
"Modern CPUs compute sine with CORDIC." Generally false. Where a fast hardware multiplier exists, argument reduction plus a minimax polynomial (or accurate-table methods) beats CORDIC, because CORDIC costs about one add-shift per result bit. In particular, do not believe the common claim that Intel's x87 FSIN "uses CORDIC" — Intel's transcendentals are table/polynomial. CORDIC stays optimal specifically where multipliers are scarce: FPGA/ASIC/DSP and dedicated blocks.
"More iterations, more accuracy." Not at every step. At θ = 0.7, 28 steps are less accurate than 24, but 40 and 56 improve again. §4 shows the 28-step trace and reports those longer checks.
Corrections
Corrected 2026-10-14: The opening said a pocket calculator found sine without ever multiplying two numbers. The CORDIC core needs no general hardware multiplier; Cochran's account of the HP-35 sine routine includes multiplication before and after the core (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The binary-shift explanation said "move the point i places right." Multiplying by 2⁻ⁱ shifts the digits right relative to a fixed point, or moves the point left relative to the digits (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The page called the rebound near 10⁻⁹ at 24 to 28 steps a double-precision floor. At θ = 0.7, the same recurrence's sine error against Math.sin falls to about 1.07×10⁻¹² after 40 steps and 1.11×10⁻¹⁶ after 56. The 28-step plot did not establish a precision floor (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The geometry text and captions said x² + m·y² was conserved and the point followed the unit circle or hyperbola. A step instead multiplies that quantity by 1 + m·2⁻²ⁱ; those curves are targets after gain compensation. In linear mode, x remains fixed (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The comparison said both mechanisms exploited logarithms to compute transcendentals. Circular CORDIC builds sine from arctangent rotations; inverse square root is algebraic (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The related note called the whole fast inverse square root routine a one-shot bit reinterpretation. The bit reinterpretation, shift and subtraction produce an initial guess; a Newton step refines it (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The markdown summary attributed the HP-35 and modern-CPU qualifications to the numerical verifier. They are in this page and research/cordic/README.md; the verifier checks selected numerical values and modes (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The structured description said the vector started at unit length. The demonstrated circular core starts at length K = 0.6072529350088813 (found by the assay line, 2026-10-14).
Corrected 2026-10-14: The hyperbolic readout labelled the maximum cosh, sinh and exp error as exp error. The label now identifies the maximum of those three errors against the math library (found by the assay line, 2026-10-14).