roundDec Method

Class: Number

Description

This method rounds an amount to the specified or implied number of decimal places. You can specify the type of rounding and justification as well.

Syntax

NumberObject.roundDec(Number decimal,String roundOption,

Number justify)

Parameters

decimal

The number of decimal places in the resulting value. The default is 2.

roundOption

A symbol that indicates the type of rounding. Valid values include:

  • "+" to round up

  • "-" to round down

  • "" to round to the nearest value. This is the default rounding option.

justify

The minimum length of the result. If necessary, spaces are inserted to the left of the rounded value. The default justification length is 0 (zero).

Returns

A String.

When Became Available

Profile v7.0

Example

type Number AMT = 123.4567 // Define Number object

 

// Assigns "  123.456" (Note 2 leading spaces,

// and forced round down)

type String S1 = AMT.roundDec(3,"-",9)