Possible bug with NAV rounding?


Code to perform a rounding as as follows:

Dec1 := 14.32455;

Precision := 0.01;

MESSAGE(FORMAT(ROUND(Dec1, Precision, ‘=’)));

Once code is executed, the result is: 14.32

I would have expected the output to be 14.33. Is my assumption correct? This code is executed in NAV ver 5Sp1. The same result is observed in ver NAV 3.10.

In case you want the answer as 14.33, then use ‘>’ instead of ‘=’, this is called Round Up.

From Help:


Type: Text or Code

This optional parameter specifies how to round the Number parameter. The default rounding method is ‘=’. The following are the options for rounding:

  • ‘=’ rounds up or down to the nearest value (default). Values of 5 or greater are rounded up. Values less than 5 are rounded down.

  • ‘>’ rounds up

  • ‘<’ rounds down