Source/Reference

Float32Exact

reference/numeric/Float32Exact.alpha

141 lines17 declarations6.3 KiBSHA-256 a0bb801f503e

def · lines 69–76

float32ExactInverseRootNaturalLogTwo

Full file
The EX2 attention path needs score/sqrt(n) in base-two units. Bound both sqrt(n) and ln(2) from their rational intervals, then require that the bounds round to the same F32 word. This avoids rounding 1/sqrt(n) before multiplying by log2(e), which can choose a different final word.
69def float32ExactInverseRootNaturalLogTwo =
70  (lambda unrestricted n : Nat .
71    (let unrestricted rootLow = (float32ExactRootLow n 1) in
72      (float32ExactBetween
73        (naturalMultiply float32RootScale float32Places)
74        (naturalMultiply (succ rootLow) (succ float32Ln2Digits))
75        (naturalMultiply float32RootScale float32Places)
76        (naturalMultiply rootLow float32Ln2Digits))))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.