Modbus decode float values

I am using Modbus/ModbusSerialMaster at master · electricimp/Modbus · GitHub
to read modbus float values ( 2 registers ).
Please see : Modbus Comms: How to Set Floating Point Values – The Preferred Pyroscope

In Node.js I can simply use buffer.readFloatBE(0) to convert the buffer of two 16bits values to a float value.

How can I do this using squirrel? i.e convert 2 16bits values to float

I would assemble your read bits to an integer value and then use casti2f() to convert it to an IEEE 754 float. Using the example on the page you link to:

local i = 0x42487df4;
local f = casti2f(i);
// Outputs 50.123

Thank you @smittytone

local float_value = casti2f(res[1] | (res[0] << 16));

does the trick.