Rounding calculator
Round a number to decimal places, significant digits or a multiple, with any of seven rounding rules.
- Version 1
- Free, no sign-up
Result: 2.675 to 2 places, half-up
| Result The rounded number, with trailing zeros kept (2.10). |
2.68 |
|---|---|
| Changed False when the value was already exact at this precision. |
yes |
| Difference result − value, exactly. |
0.005 |
Calculator math/rounding@1.
How it is calculated
decimals: round(x·10ⁿ)/10ⁿ; multiple: round(x/m)·m; ties per the chosen modeRounds exactly (no binary floating point), so 2.675 to two places with half-up gives 2.68, not the 2.67 many programs print. Choose the rule explicitly: half-up, banker's rounding (half-even), half-down, up, down (truncate), ceiling or floor.
- The rounding rule is the mode input; this calculator takes no options object.
References
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Use it from your code
curl https://api.curatedapi.com/v1/calc/math/rounding \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "2.675",
"places": 2
}'
The same call in Python
import os
import requests
payload = {
"value": "2.675",
"places": 2,
}
response = requests.post(
"https://api.curatedapi.com/v1/calc/math/rounding",
headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
json=payload,
timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
"value": "2.675",
"places": 2,
};
const response = await fetch("https://api.curatedapi.com/v1/calc/math/rounding", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log((await response.json()).result);
MCP tool calc_math_rounding at https://mcp.curatedapi.com.
Inputs, outputs and errors in the API reference.
Put it on your website
<div data-curatedapi-widget="math/rounding" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>
Use a public key registered for your site. Calculations are billed like API calls. How widgets work.
Related calculators
- Expression calculator
- Fraction calculator
- Percentage calculator
- Scientific calculator
- Statistics calculator
Add this calculator to your website
Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.
Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.