Skip to main content

clamp_arith_overflow

Function clamp_arith_overflow 

Source
pub fn clamp_arith_overflow(product: f64, ceiling: i64) -> i64
Expand description

A product that left the i64 range (an infinite or saturated f64→i64 cast): TeX’s arith_error (“Arithmetic overflow”, tex.web §105-108) clamps to ±ceiling — MAX_DIMEN for a dimension, MAX_INTEGER for a count — never a wrapped value. An Error, as TeX’s (OXIDIZED_DESIGN #519); no Err channel here, so the cap latches as emit_error does. A Warning in a box measured by our approximation (approximated_measure).