Skip to content

Commit a048c07

Browse files
committed
Derive GOLDEN_STEP from f64::consts::GOLDEN_RATIO at compile time
round(17 / φ) = 11, now computed as a const expression instead of a magic number. Verified identical value on 1.94.0. https://claude.ai/code/session_01HmdXNPit7QsTCfhJFef3Ee
1 parent 0e72b43 commit a048c07

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/hpc/gguf_indexer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ pub fn classify_tensor(name: &str, dims: &[u64]) -> LayerType {
100100
// ============================================================================
101101

102102
const BASE_DIM: usize = 17;
103-
const GOLDEN_STEP: usize = 11;
103+
/// round(17 / φ) = 11 — maximally irrational stride across BASE_DIM positions.
104+
const GOLDEN_STEP: usize = (BASE_DIM as f64 / std::f64::consts::GOLDEN_RATIO + 0.5) as usize;
104105
const FP_SCALE: f64 = 256.0;
105106

106107
/// Golden-step position table (compile-time).

0 commit comments

Comments
 (0)