sys::Obj sys::Virtual sys::Component control::Round
public class Round
[niagaraIcon="module://icons/x16/control/numericPoint.png"]
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)
public property int decimalPlaces [min=-1, config, max=3]
number of decimal places to round
public property float in [precision=3]
input value
public property float out [precision=1, readonly]
out = in rounded to a precision
public virtual override void changed(Slot slot)
Component override of changed
public virtual override void execute()
Execute
public virtual override void start()
Component override of start sets up a multiplier factor