Free · Roots and rounding
Integer Rounding with Nine Tie Rules
Integer Rounding with Nine Tie Rules with the captured controls and explicitly defined real-number rules.
- Formula & worked example
- Private in your browser
- No signup
Calculator inputs
Loading calculator…
How to use this calculator
- Enter the known values in the units shown. Results update as you type.
- Where results are editable, change one to solve backwards. Lock a value to hold it fixed.
- Use the worked example to check the method. Reset restores the starting fields.
Private by default
Inputs and results stay in this browser tab. Bookify does not upload or store the values you enter.
Formula and method
result = 3
(rounding_mode == 0) ? (sign(number) * ceilExact(abs(number))) : ((rounding_mode == 1) ? (sign(number) * floorExact(abs(number))) : ((rounding_mode == 2) ? ceilExact(number) : ((rounding_mode == 3) ? floorExact(number) : ((rounding_mode == 4) ? (sign(number) * floorExact(abs(number) + 0.5)) : ((rounding_mode == 5) ? ((isInteger(2 * number) and not (isInteger(number))) ? (sign(number) * floorExact(abs(number))) : (sign(number) * floorExact(abs(number) + 0.5))) : ((rounding_mode == 6) ? ((isInteger(2 * number) and not (isInteger(number))) ? (sign(number) * (floorExact(abs(number)) + (isInteger(floorExact(abs(number)) / 2) ? 0 : 1))) : (sign(number) * floorExact(abs(number) + 0.5))) : ((rounding_mode == 7) ? ((isInteger(2 * number) and not (isInteger(number))) ? ceilExact(number) : (sign(number) * floorExact(abs(number) + 0.5))) : ((isInteger(2 * number) and not (isInteger(number))) ? floorExact(number) : (sign(number) * floorExact(abs(number) + 0.5))))))))))
Worked example
Enter these known values and leave the other values blank.
- Number
- 2.5
- Rounded integer (selected tie and direction rule)
- 3
Assumptions and limitations
- Select among all nine direction and tie rules by showing the advanced modes.
- Decimal input is rounded directly; exact half-integers use the selected tie rule. The original positive upper input limit remains active.
Common questions
What does this calculate?
Select among all nine direction and tie rules by showing the advanced modes.
Can I solve backwards?
The captured output is forward only. Enter independent values; clearing or resetting preserves the selected controls.
References
Replace binary Number rounding helpers with exact decimal floor, ceiling and exact half detection for all nine captured modes. Retain the captured upper bound and require magnitude below 10^50, preventing loss of fractional information at integer boundaries.