Decimal.dec
Decimal.decx mc
Group: Math
Documentation
Construct a Decimal
from a Text
, Integer
or Float
.
Arguments
x
: TheText
,Integer
, orFloat
to construct aDecimal
from.mc
: TheMath_Context
to use to specify precision andRounding_Mode
. If aMath_Context
is used, there is a possibility of a loss of precision.
Errors
- If the
Text
argument is incorrectly formatted, aNumber_Parse_Error
is thrown. - If the construction of the Decimal results in a loss of precision, a
Loss_Of_Numeric_Precision
warning is attached. This can only happen if aMath_Context
value 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-.