time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (731B)


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