Decimal.opCast

struct Decimal(Hook = Abort)
const
opCast
(
T
)
()
if (
is(T == bool) ||
isNumeric!T
)

Return Value

Type: auto

For bool, follows the normal cast(bool) rules for floats in D. Numbers <= -1 returns true, numbers between -1 and 1 return false, numbers >= 1 return true.

For floating point types, returns a floating point type as close to the decimal as possible.

Throws

A ConvException if isIntegral!T and the decimal is NaN or Infinite.

A ConvOverflowException if isIntegral!T and the decimal's value is outside of T.min and T.max.

Meta