Ace Dynamic Comp Index  June 2020
Niagara-4.9
control::Round Class Reference

Detailed Description

Rounds a float to nearest n places. Uses the tie-breaker rule that positive number are rounded up if a tie-break situation exists, and negative numbers are rounded down ("more negative") if a tie-break situation exists.

Example: 123.456 with n = 0 : rounds to 123.000

with n = 1 : rounds to 123.500
with n = -1: rounds to 120.000

Example: -123.456 with n = 0 : rounds to -123.000

with n = 1 : rounds to -123.500
with n = -1: rounds to -120.000
Positive numbers:
1) multiply by 10^n
2) add 0.5 and truncate (convert to integer)
3) divide by 10^n
Negative numbers:
1) multiply by 10^n
2) subtract 0.5 and truncate (convert to integer)
3) divide by 10^n
where n = number of decimal places to round
out = round(in)

Properties


status_double out

Facets: @precision = 3 @readonly @summary

status_double in

Facets: @input @precision = 3 @summary

int decimalPlaces

Default: 0
Facets: @config @max = 3 @min = -1