Caplin Trader 4.7.1

Class: module:br/formatting/RoundingFormatter

module:br/formatting/RoundingFormatter

Formats the value to the specified rounding.

RoundingFormatter is typically used with Presenter, but can be invoked programmatically as in the following example which evaluates to "3.142":

br.formatting.RoundingFormatter.format(3.14159, {dp:3})

Constructor

new module:br/formatting/RoundingFormatter()

Implements:

Methods

format(vValue, mAttributes)

Formats the number to the specified precision.

Attribute Options:

Option Description
sf the number of significant figures to apply (optional)
dp the number of decimal places to apply (optional) rounding the number of decimal places to be rounded, omitting any trailing zeros (optional)
Parameters:
Name Type Description
vValue Variant the number.
mAttributes Map the map of attributes.
Implements:
Returns:
the number, formatted to the specified precision.