time-to-botec

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

repl.txt (701B)


      1 
      2 {{alias}}( x, n, b )
      3     Rounds a numeric value to the nearest multiple of `b^n` toward zero.
      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 4 decimal places:
     26     > var y = {{alias}}( 3.14159, -4, 10 )
     27     3.1415
     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 toward zero:
     34     > y = {{alias}}( 5.0, 1, 2 )
     35     4.0
     36 
     37     See Also
     38     --------
     39