Product Site

5.1.7.86. round

Returns the nearest integer to the receiving string value. Half is always rounded away from zero. The receiving string is first rounded according to standard Rexx rules, as though the operation receiving_string+0 had been carried out. The rounded value is then calculated from that result and returned. The result is never in exponential form. If there are no nonzero digits in the result, any minus sign is removed.
Example 5.122. String class — round method
2~round               -->    2
'-2'~round            -->    -2
2.4~round             -->    2
'-2.4'~round          -->    -2
2.5~round             -->    3
'-2.5'~round          -->    -3
'-0.1'~round          -->    0