Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

rounding

Rounding & Precision Utilities (f64)

Rounding modes and precision control for 32.32 fixed-point numbers.

Rounding Modes

  • round_down / round_up - Floor/Ceiling
  • round_half_up - Standard rounding (0.5 rounds up)
  • round_toward_zero - Truncation
  • round_away_from_zero - Round away from zero

Comparison & Clamping

  • approx_equal - Check equality within tolerance
  • clamp - Constrain value to range
  • min / max - Minimum/Maximum

Fully qualified path: cairo_fp::f64::math::rounding

Free functions

round_downRounds down to the nearest integer (floor).
round_upRounds up to the nearest integer (ceiling).
round_half_upStandard rounding (half up): rounds to nearest, with 0.5 rounding up.
round_toward_zeroRounds toward zero (truncation). Positive numbers round down, negative numbers round up.
round_away_from_zeroRounds away from zero. Positive numbers round up, negative numbers round down.
approx_equalChecks if two values are approximately equal within a tolerance.
clamp
min
max
_split_unsigned