decRound Function

Rounds a number to a specified number of decimal places.


real decRound(real figure, int decimals)

Parameter

Description

figure

The number to round off.

decimals

The number of decimal places to round to.

decimals can be positive, zero, or negative.

The value of figure, rounded to decimals decimal places.

// Returns the value 1234.66.
decRound(1234.6574,2);
 
// Returns the value 1235.
decRound(1234.6574,0);
 
// Returns the value 1200.
decRound(1234.6574,-2);

Community Additions

ADD
Show: