Decimal.dec
Decimal.decx mc
Group: Math
Documentation
Construct a Decimal from a Text, Integer or Float.
Arguments
x: TheText,Integer, orFloatto construct aDecimalfrom.mc: TheMath_Contextto use to specify precision andRounding_Mode. If aMath_Contextis used, there is a possibility of a loss of precision.
Errors
- If the
Textargument is incorrectly formatted, aNumber_Parse_Erroris thrown. - If the construction of the Decimal results in a loss of precision, a
Loss_Of_Numeric_Precisionwarning is attached. This can only happen if aMath_Contextvalue is explicitly passed.
^ Example
Create a Decimal from a Text.
c = dec "12.345"
^ Example
Create a Decimal from an Integer.
c = dec 12345
^ Example
Create a Decimal from a Float.
c = dec 12.345
Remarks
Number Format
The textual format for a Decimal is defined at https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#BigDecimal-java.lang.String-.