ROUND(a)
ROUND(a, n)
Rounds a to n decimal places.
Parameters
a(REAL)
The input value.
n (DINT)
The number of decimal places to round a to. If n is omitted, it is assumed to be 0, and a will be rounded to the nearest integer. n can be between -6 and 6. Negative values specify decimal places to the left of the decimal. Positive values specify decimal places to the right of the decimal.
Return Value
Returns a REAL.
Remarks
0.5 rounds up to 1.0.
Rounding -0.5 differs between the RMCs:
The RMC75E and RMC150E will round -0.5 to -1.0.
The RMC75S and RMC75P will round -0.5 to 0.0.
If n is outside of the range -6 to 6, the task will fault. An error will be logged in the Event Log and the user program running on the task will stop.
Examples
ROUND(0.5) returns 1.0
ROUND(123456,-3) returns 123000
ROUND(0.9876,2) returns 0.99
See Also
MROUND Function | Standard Functions
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion