Source Code

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.

Platform: Java

Packages | |

ceylon.decimal |

Dependencies | ||

`ceylon.whole` | `1.3.3` | |

`java.base` | `7` |

Values | |

`ceiling` | Source Code`shared ceiling ceiling` Round towards positive infinity. |

`down` | Source Code`shared down down` Round towards zero. |

`floor` | Source Code`shared floor floor` Round towards negative infinity. |

`halfDown` | Source Code`shared halfDown halfDown` Round towards the nearest neighbour, or round down if there are two nearest neighbours. |

`halfEven` | Source Code`shared halfEven halfEven` Round towards the nearest neighbour, or round towards the even neighbour if there are two nearest neighbours. |

`halfUp` | Source Code`shared halfUp halfUp` Round towards the nearest neighbour, or round up if there are two nearest neighbours. |

`implicitRounding` | Source Code`shared Rounding? implicitRounding` The rounding currently being used implicitly by the See also `implicitlyRounded()` |

`one` | Source Code`shared Decimal one` A |

`ten` | Source Code`shared Decimal ten` A |

`unlimitedPrecision` | Source Code`shared Rounding unlimitedPrecision` Unlimited precision. |

`unnecessary` | Source Code`shared unnecessary unnecessary` Asserts that rounding will not be required causing an exception to be thrown if it is. |

`up` | Source Code`shared up up` Round away from zero. |

`zero` | Source Code`shared Decimal zero` A |

Functions | |

`decimalNumber` | Source Code`shared Decimal decimalNumber(Whole|Integer|Float number, Rounding? rounding = null)` |

`implicitlyRounded` | Source Code`shared 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 Code`shared Decimal? parseDecimal(String str)` The |

`round` | Source Code`shared Rounding round(Integer precision, Mode mode)` Creates a rounding with the given precision and mode. |

Interfaces | |

`Decimal` | Source Code`shared 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 Code`shared DividedWithRemainder` |

`Mode` | Source Code`shared abstract Mode` A strategy for rounding the result of an operation
on two |

`Rounding` | Source Code`shared abstract Rounding` Holds precision and rounding information for use in
decimal arithmetic. A precision of |

`ceiling` | Source Code`shared ceiling` Round towards positive infinity. |

`down` | Source Code`shared down` Round towards zero. |

`floor` | Source Code`shared floor` Round towards negative infinity. |

`halfDown` | Source Code`shared halfDown` Round towards the nearest neighbour, or round down if there are two nearest neighbours. |

`halfEven` | Source Code`shared halfEven` Round towards the nearest neighbour, or round towards the even neighbour if there are two nearest neighbours. |

`halfUp` | Source Code`shared halfUp` Round towards the nearest neighbour, or round up if there are two nearest neighbours. |

`unnecessary` | Source Code`shared unnecessary` Asserts that rounding will not be required causing an exception to be thrown if it is. |

`up` | Source Code`shared up` Round away from zero. |