Skip to main content

py_round

Function py_round 

Source
pub fn py_round(x: f64, ndigits: i32) -> f64
Expand description

CPython round(x, ndigits): correct decimal rounding, half-to-even, of the exact binary value (David Gay dtoa semantics). Non-finite and zero inputs return unchanged; a magnitude overflow (CPython raises OverflowError) saturates to infinity here.