FAQ - CoMod

How can I perform rounding in RTF text modules?

Essentially, in order to round numbers in RTF, the function ROUND(x,y) of the field {=(expression)} is used. Here, x is the number being rounded and y the number of places after the decimal point to which rounding is to be performed; CIB merge also permits negative values for y.
Examples for the output as a test=5,523.254
{=ROUND({REF test},1)} yields 5,523.3
{=ROUND({REF test},-3)} yields 5,000
To illustrate the various possibilities of a rounding at "5", three variants are explained here. The term "commercial rounding" usually refers to variant 2). But, in each case, ask your specialist department to specify their requirement precisely.
1) CIB merge rounds, as do most programming languages and system libraries, to the higher number,
i.e. 2.5=3; 3.5=4; -2.5=-2; -3.5=-3
2) "Simple" rounding always rounds to the next higher number in absolute terms,
i.e. 2.5=3; 3.5=4; -2.5=-3; -3.5=-4
3) According to the IEEE standard specification, rounding should always take place to the next even number (mantissa),
i.e. 2.5=2; 3.5=4; -2.5=-2; -3.5=-4
You will obtain the behavior you desire as follows:
1) Simply use the function = ROUND as outlined above.
You can describe 2) and 3) by means of small RTF constructs. The following example yields a number in accordance with method 2) rounded from:
{=SIGN ({REF number})*{= ROUND(ABS({REF number}), places)}}

Category: Text management
« Go back