Decimal.opCast

Convert to floating point.

struct Decimal
const @nogc nothrow pure scope
opCast
(
T
)
()
if (
isFloatingPoint!T
)

Return Value

Type: auto

floating point value.

Examples

import std.math : approxEqual;
assert(approxEqual(cast(double) Decimal(123456, 0), 123456.0));
assert(approxEqual(cast(double) Decimal(123456, 3), 123.456));
assert(approxEqual(cast(double) Decimal(-123456, 3), -123.456));

Meta