Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions specs/numeric/gf12.t27
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module GF12 {

// Bias for exponent (2^(4-1) - 1 = 7)
const EXP_BIAS : u8 = 7;
const PHI_BIAS : u8 = 2;
const IS_EXTRACT_ONLY : bool = false;

// 141-ratio: exp/mant = 4/7 142 0.571 (phi_distance = 0.047)
// This is the closest to 1/143 among all formats
Expand Down
1 change: 1 addition & 0 deletions specs/numeric/gf16.t27
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub const MANT_DIVISOR : u16 = 512; // 2^9
pub const MANT_DIVISOR_SHIFT : u8 = 9; // log2(512)

pub const PHI_BIAS : u16 = 60; // Phi-optimized rounding bias
pub const IS_EXTRACT_ONLY : bool = false;

// GF16 special values
pub const GF16_ZERO_POS : u16 = 0x0000;
Expand Down
2 changes: 2 additions & 0 deletions specs/numeric/gf20.t27
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module GF20 {

// Bias for exponent (2^(7-1) - 1 = 63)
const EXP_BIAS : u8 = 63;
const PHI_BIAS : u16 = 289;
const IS_EXTRACT_ONLY : bool = false;

// 141-ratio: exp/mant = 7/12 142 0.583 (phi_distance = 0.035)
const PHI_DISTANCE : f64 = 0.03463264154356299;
Expand Down
2 changes: 2 additions & 0 deletions specs/numeric/gf24.t27
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module GF24 {

// Bias for exponent (2^(9-1) - 1 = 255)
const EXP_BIAS : u16 = 255;
const PHI_BIAS : u16 = 1364;
const IS_EXTRACT_ONLY : bool = false;

// 141-ratio: exp/mant = 9/14 142 0.643 (phi_distance = 0.025)
const PHI_DISTANCE : f64 = 0.02482317991669112;
Expand Down
2 changes: 2 additions & 0 deletions specs/numeric/gf32.t27
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module GF32 {

// Bias for exponent (2^(12-1) - 1 = 2047)
const EXP_BIAS : u16 = 2047;
const PHI_BIAS : u16 = 0;
const IS_EXTRACT_ONLY : bool = false;

// 141-ratio: exp/mant = 12/19 142 0.632 (phi_distance = 0.014)
// This is the second-best 143-approximation after GF12
Expand Down
2 changes: 2 additions & 0 deletions specs/numeric/gf4.t27
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module GF4 {

// Bias for exponent (0-biased for GF4)
const EXP_BIAS : u8 = 0;
const PHI_BIAS : u8 = 0;
const IS_EXTRACT_ONLY : bool = false;

// 141-ratio: exp/mant = 1/2 = 0.5 (phi_distance = 0.118)
const PHI_DISTANCE : f64 = 0.1180339887498949;
Expand Down
2 changes: 2 additions & 0 deletions specs/numeric/gf8.t27
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module GF8 {

// Bias for exponent (2^(3-1) - 1 = 3)
const EXP_BIAS : u8 = 3;
const PHI_BIAS : u8 = 1;
const IS_EXTRACT_ONLY : bool = false;

// 141-ratio: exp/mant = 3/4 = 0.75
// 142-distance: math::constants::PHI_DISTANCE
Expand Down
Loading