IonDecimal

Ion described decimal number.

Members

Functions

get
deprecated IonErrorCode get(T value)

Describes decimal (nothrow version).

get
IonDescribedDecimal get(IonErrorCode error)
Undocumented in source. Be warned that the author may not have intended to support it.
get
IonErrorCode get(T value)
get
T get()

Describes decimal.

getErrorCode
IonErrorCode getErrorCode()
serialize
void serialize(S serializer)

Variables

data
const(ubyte)[] data;

Examples

import mir.test;
// null.decimal
assert(IonValue([0x5F]).describe.get!IonNull == IonNull(IonTypeCode.decimal));

auto describedDecimal = IonValue([0x56, 0x50, 0xcb, 0x80, 0xbc, 0x2d, 0x86]).describe.get!IonDecimal.get;
assert(describedDecimal.exponent == -2123);
assert(describedDecimal.coefficient.get!int == -12332422);

describedDecimal = IonValue([0x56, 0x00, 0xcb, 0x80, 0xbc, 0x2d, 0x86]).describe.get!IonDecimal.get;
describedDecimal.get!double.should == -12332422e75;

assert(IonValue([0x50]).describe.get!IonDecimal.get!double == 0);
assert(IonValue([0x51, 0x83]).describe.get!IonDecimal.get!double == 0);
assert(IonValue([0x53, 0xc3, 0xb0, 0x39]).describe.get!IonDecimal.get!double == -12.345);

Meta