NLA-lib Explorer

NLAlib.Computation.binaryFloatQuantize

Library · def

Round an in-range real value to the bounded binary format; reject an exact result outside its finite interval. The represented output uses the supplied nearest tie policy.

NLAlib.Computation.binaryFloatQuantize (fmt : Float.Model.Format) (he : 2 ≤ fmt.exponentBits)
  (r : ℝ → ℤ) (hr : ∀ (x : ℝ), Computation.AbsRelErr 0 (1 / 2) x ↑(r x)) (a : ℝ) :
  Option (Computation.BinaryFloat fmt)

Full source on GitHub

Import NLAlib.Matrix.FinitePrecision.BinaryFloatCarrier.