GF-T8: порядок в тритах
Вы узнаете
Как GF-T сохраняет деление по phi, но хранит порядок в сбалансированных тритах: 1 + 3 трита + 4 бита.
GF-T — это GoldenFloat с троичным порядком. В GF-T8 1 знак, 3 трита порядка и 4 бита мантиссы. Три трита дают 27 значений порядка, смещение 13 делает их сбалансированными вокруг нуля, а смещение 26 оставлено как особое неконечное значение. Спека проверяет деление как E / M в тысячных: 3000 / 4 = 750.
Попробуйте
Запустите два теста gft8.t27. Затем найдите exp_values и is_finite и скажите, какое смещение не конечно.

GF-T8 as the spec lays it out, read from gft8.t27. Lesson 24 of the GoldenFloat course.
specs/numeric/gft8.t27
// SPDX-License-Identifier: Apache-2.0
// gft8.t27 -- GF-T8: the golden-ratio ternary ladder, 8-bit class.
//
// TWO AXES, FOUR FAMILIES. GF and GF-T are derived from the golden ratio; BNF and
// TNF are derived from the theorems, as the optimisation result for ternary
// networks. They are not renamings of each other and they answer different
// questions.
//
// GF-T applies GF's rule to POSITIONS, and a trit is a position -- the golden
// section divides the payload the way it divides a segment:
//
// E_t = round((N-1)/phi^2) = 3, M = N - 1 - E_t = 4
//
// Every rung lands exactly: 1 + 3 + 4 = 8, no position unspent. The ratio
// E_t/M = 0.7500 against 1/phi = 0.6180, a phi-distance of 0.1320
// which falls toward zero up the ladder, by construction, exactly as in GF.
//
// What this buys and what it costs, measured against TNF8 on the reference
// oracle: GF-T's exponent spans 13 binades either side where TNF sizes its own
// for the range a workload actually visits. GF-T pays for that in mantissa. At 64
// bits GF-T takes 1.3e8 times the range for 1.2e5 times the error -- neither
// dominates, and the corollary on the pair (M_eff, binades) forbids ranking them
// without naming a workload.
//
// Supersedes the ad-hoc parameters this rung carried before 2026-08-09, where the
// exponent was sized at roughly log2(N) trits with no documented rule and left
// positions unspent.
//
// layout: [ sign(1) | E = 3 balanced-ternary trits | M = 4 binary bits ]
// value = (-1)^sign * (1 + M/2^4) * 2^e, e in [-13,+13]
module triformat_gft8 {
use base::types;
const SIGN_BITS: u32 = 1;
const EXP_TRITS: u32 = 3; // round((N-1)/phi^2)
const MANT_BITS: u32 = 4; // the remaining positions, all of them
const EXP_OFFSET: u32 = 13;
const OFFSET_MAX: u32 = 26;
fn is_finite(offset: u32) -> bool { return offset != OFFSET_MAX; }
fn exp_values() -> u32 { return 27; }
// ---- Tests / invariants ----
// The golden section is the rule; this asserts it rather than remembering it.
test golden_section {
assert(SIGN_BITS + EXP_TRITS + MANT_BITS == 8, "1 + E_t + M = N, every position spent");
assert(EXP_TRITS * 1000 / MANT_BITS == 750, "E_t/M holds the golden section");
}
test balanced_offsets {
assert(EXP_OFFSET * 2 == OFFSET_MAX, "balanced: offset_max = 2 * exp_offset");
}
}
Все уроки
Модуль 1 · Правило и его числа
Одно правило делит каждую ширину, отношение, к которому оно стремится, и числа Люка за тройкой 3.
Модуль 2 · Почему phi, почему три
Почему деление идёт по phi, почему основание три и как спека проверяет, что GF16 хранит phi.
Модуль 3 · Малые ступени: от GF4 до GF8
GF4, GF6 и GF8 — меньше всего битов, и округление до целых битов стоит здесь дороже всего.
Модуль 4 · От десяти до четырнадцати битов
GF10, GF12 и GF14 и то, как расстояние до 1 / phi меняется с ростом слова.
Модуль 5 · GF16 в работе
Основной 16-битный формат, скалярное произведение из двух слагаемых в GF-T16, затем GF20 и GF24.
Модуль 6 · От GF32 до GF64
GF32 рядом с IEEE single, GF48 без пары в IEEE, GF64 рядом с IEEE double.
Модуль 7 · От GF96 до GF256
GF96, GF128 и GF256, где спеки держат раскладку инвариантами.
Модуль 8 · Самые широкие ступени, затем триты
GF512 и GF1024, две самые широкие ступени, затем GF-T8, где порядок уходит в триты.
Модуль 9 · Ещё триты, затем декодирование
GF-T16 и GF-T32, затем почему фиксированные поля декодируются параллельно, а posit — нет.