Read Me - Common Public License V1.0 - Copyright Notice(©)

trunc


>>-trunc-+-----+-----------------------------------------------><
         +-(n)-+

Returns the integer part the receiving string, which is a number, and [n] decimal places. The default [n] is 0 and returns an integer with no decimal point. If you specify [n] , it must be a positive whole number or zero. The receiving string is first rounded according to standard Rexx rules, as though the operation receiving_string+0 had been carried out. This number is then truncated to [n] decimal places or trailing zeros are added if needed to reach the specified length. The result is never in exponential form. If there are no nonzero digits in the result, any minus sign is removed.

String class - trunc method

12.3~trunc            ->    12
127.09782~trunc(3)    ->    127.097
127.1~trunc(3)        ->    127.100
127~trunc(2)          ->    127.00

Note

The [number] is rounded according to the current setting of NUMERIC DIGITS if necessary, before the method processes it.

Read Me - Common Public License V1.0 - Copyright Notice(©)