XSIRound
 
 
 

XSIRound

Introduced

v5.0

Description

Exposes the VBScript Round function for use by other script languages. The JScript Math.round method always returns an integer result, whereas this command is more versatile because it can limit the number of decimal places of a floating point number.

Scripting Syntax

oReturn = XSIRound( in_Expression, [in_NumDecimals] );

Return Value

Return the rounded number

Parameters

Parameter Type Description
in_Expression Any number, but normally this would be a Double or Float Number to Round
in_NumDecimals Long Number of decimal points to leave in the returned value.

Default Value: 0

Examples

JScript Example

//INFO : 5
Application.LogMessage( XSIRound( 5.123 ) ) ;
//INFO : 5.1
Application.LogMessage( XSIRound( 5.123, 1 ) ) ;
//INFO : 5.123
Application.LogMessage( XSIRound( 5.123, 5 ) ) ;
//INFO : 0.333333333333333
Application.LogMessage( 1/3 ) ;
//INFO : 0.33
Application.LogMessage( XSIRound( 1/3, 2 ) ) ;