f32-to-number

xod/bits/f32-to-number

Converts 32-bit IEEE-754 encoded floating point number presented as four bytes to a number. A result of the conversion will be in range between -3.4E+38 to 3.4E+38 with an accuracy of 7 digits. It means, a float number greater than seven digits in length will be inaccurate and lose a fractional part.
f32-to-number
@/f32-to-number
Converts 32-bit IEEE-754 encoded floating point number presented as four bytes to a number. A result of the conversion will be in range between -3.4E+38 to 3.4E+38 with an accuracy of 7 digits. It means, a float number greater than seven digits in length will be inaccurate and lose a fractional part.
B3byte
Most significant byte
B2byte
B1byte
B0byte
Least significant byte
f32-to-number
OUT
B3
B2
B1
B0
OUTnumber

C++ implementation

node {
    void evaluate(Context ctx) {
        uint8_t bytes[4];

        bytes[0] = getValue<input_B0>(ctx);
        bytes[1] = getValue<input_B1>(ctx);
        bytes[2] = getValue<input_B2>(ctx);
        bytes[3] = getValue<input_B3>(ctx);

        Number output = *(Number*)bytes;

        emitValue<output_OUT>(ctx, output);
    }
}

Tabular tests

B3B2B1B0OUT
C8h12h7Ch08h-150000.125
48h12h7Ch08h150000.125
BFh80h00h00h-1.00
00h00h00h00h0.00