new module:ct-element /formatter /Significant Figures Formatter()
Formats a number to the specified number of significant figures.
SignificantFiguresFormatter
is typically used in the XML Renderer Framework, but can be invoked programmatically
as in the following example which evaluates to '3.142':
SignificantFiguresFormatter.format(3.14159, {sf:4})
- Implements:
Methods
format(vValue, mAttributes) → {String}
Formats a number to the specified number of significant figures.
Parameters:
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
vValue |
String | Number | the number. |
||||||||
mAttributes |
Map |
the map of attributes. Properties
|
- Implements:
Returns:
the number, formatted to the specified precision.
- Type
- String