Constructors
NumberFormat
#Create a new NumberFormat state.
public NumberFormat()
specialCaseIntegers,
If true, numbers that are close to integers are formatted as such.
specialCaseRationals,
If true, numbers that are close to rationals (ie. fractions) are formatted as such.
specialCaseIntegralConstants,
If true, number that are multiples of pi are formatted as such.
specialCaseRationalConstants,
If true, numbers that are some fraction of pi are formatted as such.
specialCaseIntegralRoots,
If true, numbers that are roots of integers are formatted as such.
minimumDecimals,
Number of decimal places to always include during regular number formatting.
maximumDecimals,
Maximum number of decimals to display during regular number formatting.
roundLastDecimal,
If true, excess decimals are rounded away silently. If false, they are still rounded but an ellipsis is appended to mark the loss.
mantissaMinimumDecimals,
Number of decimals to always include during scientific notation formatting.
mantissaMaximumDecimals,
Maximum number of decimals to display during scientific notation formatting.
eNotationLowerLimit,
Numbers smaller than 10^limit will be displayed using scientific notation.
eNotationUpperLimit,
Numbers bigger than 10^limit will be displayed using scientific notation.
eNotationSuperscript
If true, scientific notation uses superscript symbols for the power.
Properties
Honest
#Same as Minimal, but whenever the displayed digits do not capture the exact value, an ellipsis is appended.
Intent
#Gets the standard humanistic number formatting for Grasshopper. The numeric format attempts to reverse engineer all intent.
MantissaMaximumDecimals
#Maximum number of decimals to display for the mantissa during scientific formatting.
MantissaMinimumDecimals
#Minimum number of decimals to display for the mantissa during scientific formatting.
Minimal
#Gets the number formatting rules which most closely track common formatting in software. Floating point numbers always have at least one decimal digit, but no more than 6 and the final digit is rounded.
RoundLastDecimal
#Round away excess decimals silently. If false, excess decimals are still rounded, but an ellipsis character will be appended to mark the loss.
ScientificNotationLowerThreshold
#Gets the power of ten below which numbers are formatted using scientific notation.
ScientificNotationSuperscript
#Gets whether to format scientific notation using 'e' or using superscripts. If this property yields false, the formatting should look like 1.534e-17, if this property yields true, the formatting should look like 1.534×10⁻¹⁷.
ScientificNotationUpperThreshold
#Gets the power of ten above which numbers are formatted using scientific notation.
SpecialCaseRationalConstants
#Numbers that are close to fractional values of PI will be displayed as such.
Methods
Format
#Format a list of numbers until they fit within the provided limit. This method will iteratively lower the MaximumDecimals to 1 until the text fits within the limit, or it will return the shortest string.
Returns: Formatted string.
Modify
#Modify this formatting.
public NumberFormat Modify()
bool?
specialCaseIntegers = null,
bool?
specialCaseRationals = null,
bool?
specialCaseIntegralConstants = null,
bool?
specialCaseRationalConstants = null,
bool?
specialCaseIntegralRoots = null,
int?
minimumDecimals = null,
int?
maximumDecimals = null,
bool?
roundLastDecimal = null,
int?
mantissaMinimumDecimals = null,
int?
mantissaMaximumDecimals = null,
int?
eNotationUpperLimit = null,
int?
eNotationLowerLimit = null,
bool?
eNotationSuperscript = null