repl.txt (693B)
1 2 {{alias}}( x, n, b ) 3 Rounds a numeric value to the nearest multiple of `b^n` on a linear scale. 4 5 Due to floating-point rounding error, rounding may not be exact. 6 7 Parameters 8 ---------- 9 x: number 10 Input value. 11 12 n: integer 13 Integer power. 14 15 b: integer 16 Base. 17 18 Returns 19 ------- 20 y: number 21 Rounded value. 22 23 Examples 24 -------- 25 // Round to 2 decimal places: 26 > var y = {{alias}}( 3.14159, -2, 10 ) 27 3.14 28 29 // If `n = 0` or `b = 1`, standard round behavior: 30 > y = {{alias}}( 3.14159, 0, 2 ) 31 3.0 32 33 // Round to nearest multiple of two: 34 > y = {{alias}}( 5.0, 1, 2 ) 35 6.0 36 37 See Also 38 -------- 39