Numeric functions

Top  Previous  Next

Function name:

Usage:

Abs

Abs (num)

Returns the absolute value of a number.

Add

Add (num, num...)

Takes a list of numbers and adds them together.  Missing data is not counted.

Avg

Avg (num, num ...)

Takes any number of values and averages them, ignoring no data.

Max

Max (num...)

Takes a list of numbers and returns the biggest one.

Min

Min (num...)

Takes a list of numbers and returns the smallest one.

Number

Number (Str)

Returns the number stored in the string, str.  Returns 0 if the string is not a number.

Sqr

Sqr(num)

Returns the square of the given num.

AsString

AsString(number[, precision])

Converts a number to a string, numtrail is the number of digits following the decimal point.

This is the simpler version of AsStringF().  AsString() uses the "f" format type, no Width, and optional precision.

AsStringF

AsStringF( number, FormatString )

Converts a number to a string.  FormatString looks like "%[Width][.Precision]Type

 

Width is the number of digits to the left of the decimal point.  (spaces will be used if no significant digits are available)

Precision is the number of digits to the right of the decimal point.

Type is one of:

e  = Scientific

f  = Fixed

g  = General

m  = Money

n  = Number (floating)

 

Examples:

 

AsStringF( 123.456, "%e" ) = 1.2345600000000E+002

AsStringF( 123.456, "%f" ) = 123.456

AsStringF( 123.456, "%.1f" ) = 123.5

AsStringF( 123.456, "%.2m" ) = $123.46

 

Note: Any text in the format string that is not part of the % specification will be added as a string literal:

 

AsStringF( 123.456, "Hello %.1f world" ) = Hello 123.5 world

 

AsStringIntF

AsStringIntF( number, FormatString )

Converts a number to a string.  FormatString looks like "%[Width][.Precision]Type

 

This function begins by rounding the "number" value to create an integer type.  The formatting is the same as AsStringF(), but the possible format types are different since the value is not floating point.

 

Width is the number of digits to the left of the decimal point.  (spaces will be used if no significant digits are available)

Precision is the number of digits to the right of the decimal point.

Type is one of:

d  = Decimal (integer)

u  = Unsigned decimal

x  = Hexadecimal

 

Examples:

 

AsStringF( 123.456, "%d" ) = 123

AsStringF( 123.56, "%d" ) = 124

AsStringF( 11, "%x" ) = B

AsStringF( 255, "%x" ) = FF

 

Note: Any text in the format string that is not part of the % specification will be added as a string literal:

AsStringF( 123.56, "The value is (%d)" ) = The value is (124)