Two to the x

You will learn

How exp2 splits x into a whole part and a fraction, and why its tests only reach the whole part.

The header of gft_exp2.t27 calls exp2 the missing building block for a GF-T softmax. on_comb splits x into a whole part k and a fraction f: k sets the offset, k + 40, and pow2_frac turns f into the mantissa. The header claims at most 1 ULP of error, measured in the prototype, but all 4 tests use whole inputs, 0, 1.0, -1.0 and 2.0, so f is 0 and pow2_frac returns 0 whatever its coefficients. The browser skips all 4 tests because its runner does not know assert_eq yet; the native t27c runs all 4, all pass, none vacuous. The recording runs t27c test-report, then a one-line sed that drops the minus sign of k for negative x, and t27c test-report again: exactly one test fails, em1: 2^-1 comes out as 2.0, not 0.5. git checkout puts the line back, and sha256sum prints the same hash as before the edit. Every byte in the recording was printed by the command; only the typing is staged.

Open the interactive lesson →