Round real number to given digits
Block that outputs the input after rounding it to n
digits.
For example,
-
set
n = 0
to round to the nearest integer,
-
set
n = 1
to round to the next decimal point, and
-
set
n = -1
to round to the next multiple of ten.
Hence, the block outputs
y = floor(u*(10^n) + 0.5)/(10^n) for u > 0,
y = ceil(u*(10^n) - 0.5)/(10^n) for u < 0.
-
March 2, 2020, by Michael Wetter:
Changed icon to display dynamically the output value.
-
September 14, 2017, by Jianjun Hu:
First implementation, based on the implementation of the
Modelica Standard Library.
Generated at 2025-03-13T19:24:49Z
by OpenModelicaOpenModelica 1.24.5 using GenerateDoc.mos