GF128: a quad
You will learn
The 128-bit GoldenFloat, 1 + 49 + 78, and the four invariants that hold its layout.
GF128 has 128 bits: 1 sign, 49 exponent, 78 mantissa. IEEE quad spends 15 bits on the exponent. The spec holds the layout with four invariants: the fields partition the word, the mantissa and the exponent follow the closed form, and the shifts follow the layout.
Try it
Read the four invariants of gf128.t27 and check SIGN_SHIFT and EXP_SHIFT against the field widths by hand.

GF128: 128 bits as the spec lays them out, read from gf128.t27. Lesson 20 of the GoldenFloat course.
specs/numeric/gf128.t27
// SPDX-License-Identifier: Apache-2.0
; gf128.t27 -- GoldenFloat128 Encode/Decode
; GF128: 128-bit floating point with 1 sign + 49 exponent + 78 mantissa
; Bit layout: [S(1) E(49) M(78)] = [127:127][126:78][77:0]
; phi^2 + 1/phi^2 = 3 | TRINITY
; Generated by the closed-form rule e = round((N-1)/phi^2), m = N-1-e.
; STATUS: Conj (spec-only; no RTL on this repo's path).
module triformat-gf128;
// ============================================================================
// Constants -- derived from the closed-form rule
// ============================================================================
pub const TOTAL_BITS : u16 = 128;
pub const SIGN_BITS : u8 = 1;
pub const EXP_BITS : u8 = 49;
pub const MANT_BITS : u16 = 78;
pub const SIGN_SHIFT : u16 = 127;
pub const EXP_SHIFT : u16 = 78;
pub const MANT_SHIFT : u16 = 0;
; BIAS = 2^(48) - 1 -- multi-word constant (exceeds u64); see codegen
; EXP_MAX = 2^49 - 1 -- multi-word constant (exceeds u64)
pub const BIAS_EXPR : str = "2^(49-1) - 1";
pub const EXP_MAX_EXPR : str = "2^49 - 1";
// E/M ratio (target: 1/phi ~ 0.6180339887)
pub const EM_RATIO : f64 = 0.628205128205;
pub const PHI_DIST : f64 = 0.010171139455;
pub const PHI_BIAS_STATUS : str = "OPEN -- not derivable from closed form; empirical per format";
// PHI_BIAS for this rung is NOT defined. The published formula
// PHI_BIAS = EXP_MAX - BIAS reproduces GF64 only and is RETRACTED as a general law.
// Do NOT invent a value via Fibonacci/Lucas/square coincidence; those are
// descriptive, not prescriptive.
// ============================================================================
// Invariants -- the Fpath below, made executable (W601)
//
// This file declared its own falsification path in a comment and nothing
// checked it. W600's per-test measurement found 38 specs that compile while
// asserting nothing; this is one, and the rule it is derived from is stated
// precisely enough to be a test.
// ============================================================================
invariant gf128_field_widths_partition_the_word {
@compileAssert(SIGN_BITS + EXP_BITS + MANT_BITS == TOTAL_BITS);
}
invariant gf128_closed_form_mantissa {
// m = N - 1 - e, the second half of the generating rule
@compileAssert(MANT_BITS == TOTAL_BITS - 1 - EXP_BITS);
}
invariant gf128_closed_form_exponent {
// e = round((N-1)/phi^2) <=> (e - 1/2)*phi^2 <= N-1 <= (e + 1/2)*phi^2
// Stated as bounds because the rule rounds; phi^2 = 2.618033988749895.
@compileAssert((EXP_BITS as f64 - 0.5) * 2.618033988749895 <= TOTAL_BITS as f64 - 1.0);
@compileAssert(TOTAL_BITS as f64 - 1.0 <= (EXP_BITS as f64 + 0.5) * 2.618033988749895);
}
invariant gf128_shifts_follow_the_layout {
@compileAssert(SIGN_SHIFT == TOTAL_BITS - 1);
@compileAssert(EXP_SHIFT == MANT_BITS);
@compileAssert(MANT_SHIFT == 0);
}
; ============================================================================
; Claim-status: Conj
; Fpath: closed-form rule mis-applied (verify e = round((128-1)/phi^2) = 49, m = 78)
; or RTL emission diverges from this constant set.
; As of W601 the Fpath above is CHECKED by the invariants in this file.
; ============================================================================
All lessons
Module 1 · The rule and its numbers
One rule splits every width, the ratio it aims at, and the Lucas numbers behind the 3.
Module 2 · Why phi, why three
Why the split is phi, why base three, and how a spec checks GF16 keeps phi.
Module 3 · The small rungs: GF4 to GF8
GF4, GF6 and GF8, the fewest bits, where rounding to whole bits costs the most.
Module 4 · Ten to fourteen bits
GF10, GF12 and GF14, and how the distance from 1 / phi moves as the word grows.
Module 5 · GF16 at work
The primary 16-bit format, a two-term dot product in GF-T16, then GF20 and GF24.
Module 6 · GF32 to GF64
GF32 beside IEEE single, GF48 with no IEEE twin, GF64 beside IEEE double.
Module 7 · GF96 to GF256
GF96, GF128 and GF256, where the specs hold the layout with invariants.
Module 8 · The widest rungs, then trits
GF512 and GF1024, the two widest rungs, then GF-T8, where the exponent moves to trits.
Module 9 · More trits, then the decode
GF-T16 and GF-T32, then why fixed fields decode in parallel and a posit does not.