t27.aiEnglish

GF512: пятьсот двенадцать битов

Вы узнаете

Как правило делит 512 битов на 1 + 195 + 316, отношение в пределах 0.001 от 1 / phi.

В GF512 512 битов: 1 знак, 195 порядка, 316 мантиссы. Его отношение E / M равно 0.617, меньше чем в 0.001 от 1 / phi. Чем шире слово, тем ближе целые биты могут подойти к цели, и таблица семейства это показывает.

Попробуйте

Найдите PHI_DIST в gf512.t27 и сравните с GF14 и GF48. Затем проверьте SIGN_SHIFT и EXP_SHIFT вручную.

Открыть интерактивный урок →

GoldenFloat 22: GF512
GoldenFloat 22: GF512 ↗

GF512: 512 bits as the spec lays them out, read from gf512.t27. Lesson 22 of the GoldenFloat course.

specs/numeric/gf512.t27

// SPDX-License-Identifier: Apache-2.0
; gf512.t27 -- GoldenFloat512 Encode/Decode
; GF512: 512-bit floating point with 1 sign + 195 exponent + 316 mantissa
; Bit layout: [S(1) E(195) M(316)] = [511:511][510:316][315: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 (extrapolated; no RTL, no validated arithmetic).

module triformat-gf512;

// ============================================================================
// Constants -- derived from the closed-form rule
// ============================================================================

pub const TOTAL_BITS : u16 = 512;
pub const SIGN_BITS  : u8 = 1;
pub const EXP_BITS   : u8 = 195;
pub const MANT_BITS  : u16 = 316;

pub const SIGN_SHIFT : u16 = 511;
pub const EXP_SHIFT  : u16 = 316;
pub const MANT_SHIFT : u16 = 0;

; BIAS = 2^(194) - 1   -- multi-word constant (exceeds u64); see codegen
; EXP_MAX = 2^195 - 1   -- multi-word constant (exceeds u64)
pub const BIAS_EXPR    : str = "2^(195-1) - 1";
pub const EXP_MAX_EXPR : str = "2^195 - 1";

// E/M ratio (target: 1/phi ~ 0.6180339887)
pub const EM_RATIO   : f64 = 0.617088607595;
pub const PHI_DIST   : f64 = 0.000945381155;

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 gf512_field_widths_partition_the_word {
    @compileAssert(SIGN_BITS + EXP_BITS + MANT_BITS == TOTAL_BITS);
}

invariant gf512_closed_form_mantissa {
    // m = N - 1 - e, the second half of the generating rule
    @compileAssert(MANT_BITS == TOTAL_BITS - 1 - EXP_BITS);
}

invariant gf512_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 gf512_shifts_follow_the_layout {
    @compileAssert(SIGN_SHIFT == TOTAL_BITS - 1);
    @compileAssert(EXP_SHIFT == MANT_BITS);
    @compileAssert(MANT_SHIFT == 0);
}

; ============================================================================
; Claim-status: Conj
; Fpath: any matched-substrate accuracy test (e.g. GF512 vs binary512/posit512/takum512)
;        where GF512 fails to be parity-class or better falsifies this rung.
;        Note: dynamic range of phi^256 overflows binary512 normalization at some n;
;        benchmarks MUST be normalised to in-range regimes.
; ============================================================================

Открыть спеку урока в плеере ↗

Все уроки