Numbers & math
Scalar
round()
Rounds x to s decimal places
Reference: Haybarn WASM 2.0.0-rc12
Arguments & returns
16 overloadsround(x)
Scalar
round(x, precision)
Scalar
Round numbers to decimal places
Round a numeric value to a chosen number of decimal places. A negative precision rounds to tens, hundreds, or larger units.
NULL stays NULL. For exact decimal inputs, halfway values round away from zero.
Haybarn WASM 2.0.0-rc12 ยท In your browser
Guide example ยท Run to view results.
| amount | nearest_ten | missing |
|---|---|---|
12.35 | 130 | NULL |
Watch for: Floating point values can be approximate. Use DECIMAL for examples where the exact decimal halfway point matters.
Example
Haybarn WASM 2.0.0-rc12 ยท In your browser
Engine example ยท Run to view results.