round_decimal_f64

Function round_decimal_f64 

Source
fn round_decimal_f64(v: f64) -> f64
Expand description

Rounds an f64 to [DECIMAL_PLACES] decimal places using pure arithmetic.

Eliminates the string formatting roundtrip entirely. For values like 4.6 that can’t be exactly represented in IEEE 754, this cleans up trailing noise (e.g. 4.60000000000000054.6).

Splits into integer and fractional parts before scaling to avoid overflow: large SAS datetime values (~1.9e9) multiplied by 1e14 would exceed f64’s exact integer range (2^53), causing rounding errors.