NOP Design Home Page
Documentation
TOC/Index
Search
Downloads



FormatNumber

Formats floating point or integer numbers with fixed precision

The FormatNumber function allows you to format numeric data types (Number, Integer) with fixed precision for display. The FormatNumber call returns a string version of the number, matching your format specification.

Format specifications may include the # symbol, the index/mantissa seperator '.', and any locale specific numeric seperator (ie. ',').

FormatNumber will only include as many characters of your format specification's index (the part of the number before the decimal place) as necessary to format the specified number. The mantissa will be '0' padded. For example, if you use the format specifier "###,###,###.##" on the number "12.34" your format specifier will be truncated to "##.##" automatically, and your result will be "12.34". Using the same format specifier, if you use the number "123,456" your result will be "123,456.00".

Note: SIML uses floating point numbers internally for the "number" data type, and is limited in precision based on your operating system.

Sample Source

fMyVariable := 123.456

Say FormatNumber 325.2242 As "###.###"
Say " "

Say FormatNumber fMyVariable As "###.##"
Say " "

Say FormatNumber fMyVariable As "##,###.##"
Say " "

Say FormatNumber fMyVariable As "#,###,###.##"

Related Function(s):
   Convert; Say;

Minimum version: 4.7