Oct 2026
JavaScript floating-point
Rounding in JavaScript: Math.round() Half-Up Behavior and Banker’s Rounding
JavaScript's Math.round() rounds ties toward +∞, not away from zero, so Math.round(-2.5) is -2. Banker's rounding (half-to-even) requires a custom function or decimal library.
Read explanation →
