NLA-lib Explorer

Real.roundNearest

Library · def

Rounding to nearest onto Real.floatGrid t: with k = \lfloor \log_2 \lvert x \rvert \rfloor (Int.log) and e = k + 1 - t, the integer nearest to x 2^{-e} (Mathlib's round, ties upward) times 2^e. At \mathbf{x} = 0 it is 0.

Real.roundNearest (t : ℕ) (x : ℝ) : ℝ

Full source on GitHub

Import NLAlib.ForMathlib.Algebra.Order.Round.