Difference between revisions of "Round"

From MiniScript Wiki
Jump to navigation Jump to search
 
Line 9: Line 9:
 
! Parameter Name !! Default Value !! Meaning
 
! Parameter Name !! Default Value !! Meaning
 
|-
 
|-
| ''x'' || number || number to round
+
| ''x'' || 0 || number to round
 +
|-
 +
| ''decimalPlaces'' || 0 || number of decimal places to round to (may be negative)
 
|}
 
|}
  

Latest revision as of 15:14, 25 March 2022

round rounds a number to the specified number of decimal places.

See also: floor, ceil

Arguments

Parameter Name Default Value Meaning
x 0 number to round
decimalPlaces 0 number of decimal places to round to (may be negative)

Examples

round(pi, 2)             // returns 3.14
round(12345, -3)         // returns 12000