Previous Topic

Next Topic

Inhoudsopgave

Book Index

RoundTo Function

Applies to

All Isah VBscripts.

Syntax

Function Function RoundTo (Number, DecimalPlaces)

Description

Rounds a number to a specified number of decimal places.

Remarks

This general function is available in all Isahscripts. In contrast to the standard VBScript Round function,which performs round to even, the RoundTo function performs symmetric arithmetic rounding: a number that is halfway between two possible rounded values is always rounded to the larger number.

Parameters

Code Snippet

Dim var1, var2, var3, var4, var5, var6

var1 = RoundTo(10.4, 0) ' var1 contains 10

var2 = RoundTo(10.5, 0) ' var2 contains 11

var3 = RoundTo(1.755, 1) ' var3 contains 1.8

var4 = RoundTo(1.755, 2) ' var4 contains 1.76

var5 = RoundTo(0.82715, 4) ' var5 contains 0.8272

var6 = RoundTo(1187, -2) ' var6 contains 1200