Decimal floating point arithmetic. The focus of this module
is the Decimal
type which performs computations using
decimal floating point arithmetic. An of Decimal
may be
obtained by calling decimalNumber()
or parseDecimal()
.
A Rounding
is used to specify how results of calculations
should be rounded, and an instance may be obtained by
calling round()
. The implicitRounding
function may
be used to associate a Rounding
with a computation,
performing the whole computation with an implicit rounding
strategy.
Packages | |
ceylon.decimal |
Dependencies | ||
ceylon.whole | 1.3.0 | |
java.base | 8 |
Values | |
ceiling | Source Codeshared ceiling ceiling Round towards positive infinity. |
down | Source Codeshared down down Round towards zero. |
floor | Source Codeshared floor floor Round towards negative infinity. |
halfDown | Source Codeshared halfDown halfDown Round towards the nearest neighbour, or round down if there are two nearest neighbours. |
halfEven | Source Codeshared halfEven halfEven Round towards the nearest neighbour, or round towards the even neighbour if there are two nearest neighbours. |
halfUp | Source Codeshared halfUp halfUp Round towards the nearest neighbour, or round up if there are two nearest neighbours. |
implicitRounding | Source Codeshared Rounding? implicitRounding The rounding currently being used implicitly by the See also implicitlyRounded() |
one | Source Codeshared Decimal one A |
ten | Source Codeshared Decimal ten A |
unlimitedPrecision | Source Codeshared Rounding unlimitedPrecision Unlimited precision. |
unnecessary | Source Codeshared unnecessary unnecessary Asserts that rounding will not be required causing an exception to be thrown if it is. |
up | Source Codeshared up up Round away from zero. |
zero | Source Codeshared Decimal zero A |
Functions | |
decimalNumber | Source Codeshared Decimal decimalNumber(Whole|Integer|Float number, Rounding? rounding = null) |
implicitlyRounded | Source Codeshared Decimal implicitlyRounded(Decimal calculate(), Rounding rounding) Performs an arbitrary calculation with the given rounding used
implicitly when arithmetic operators are applied to During a call to this method the The implicit rounding will only take effect on the current
thread. The See also implicitRounding |
parseDecimal | Source Codeshared Decimal? parseDecimal(String str) The |
round | Source Codeshared Rounding round(Integer precision, Mode mode) Creates a rounding with the given precision and mode. |
Interfaces | |
Decimal | Source Codeshared Decimal A decimal floating point number. This class provides support
for fixed and arbitrary precision numbers. Values are immutable
and represented as |
Classes | |
DividedWithRemainder | Source Codeshared DividedWithRemainder |
Mode | Source Codeshared abstract Mode A strategy for rounding the result of an operation
on two |
Rounding | Source Codeshared abstract Rounding Holds precision and rounding information for use in
decimal arithmetic. A precision of |
ceiling | Source Codeshared ceiling Round towards positive infinity. |
down | Source Codeshared down Round towards zero. |
floor | Source Codeshared floor Round towards negative infinity. |
halfDown | Source Codeshared halfDown Round towards the nearest neighbour, or round down if there are two nearest neighbours. |
halfEven | Source Codeshared halfEven Round towards the nearest neighbour, or round towards the even neighbour if there are two nearest neighbours. |
halfUp | Source Codeshared halfUp Round towards the nearest neighbour, or round up if there are two nearest neighbours. |
unnecessary | Source Codeshared unnecessary Asserts that rounding will not be required causing an exception to be thrown if it is. |
up | Source Codeshared up Round away from zero. |