The OpenD Programming Language

IonFloat

Ion floating point number.

Members

Functions

get
T get()
get
IonErrorCode get(T value)
getErrorCode
IonErrorCode getErrorCode()
serialize
void serialize(S serializer)

Variables

data
const(ubyte)[] data;

Examples

// null
assert(IonValue([0x4F]).describe.get!IonNull == IonNull(IonTypeCode.float_));

// zero
auto ionFloat = IonValue([0x40]).describe.get!IonFloat;
assert(ionFloat.get!float == 0);
assert(ionFloat.get!double == 0);
assert(ionFloat.get!real == 0);

// single
ionFloat = IonValue([0x44, 0x42, 0xAA, 0x40, 0x00]).describe.get!IonFloat;
assert(ionFloat.get!float == 85.125);
assert(ionFloat.get!double == 85.125);
assert(ionFloat.get!real == 85.125);

// double
ionFloat = IonValue([0x48, 0x40, 0x55, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00]).describe.get!IonFloat;
assert(ionFloat.get!float == 85.125);
assert(ionFloat.get!double == 85.125);
assert(ionFloat.get!real == 85.125);

Meta