String to IEEE 754 Converter

For my Project to write with a dashdoard slider to my DDC controller i need to convert the Decimal value to a IEEE-754 Floating Point.
On this site i found a correct working converter. IEEE-754 Floating Point Converter
is it possible to do this calculation witch a function? i attempted various functions but never get the correct Hexadecimal

can anyone help me with this one?

1 Like

Hi, there is this flow for your question

https://flows.nodered.org/flow/359ead34237b7ab6ec0465ee85a34b62

ok thank you, tried that one before... get this when i inject a value 44 DEC
2021-04-13 21_30_11-Window

I need the other way arround.

In what form do you want the result and what do you want to do with it?

i need to inject a string to a function. the input is for instance 44 the output must be like 0x42300000


or 42300000

The question is why do you need to do it?

sorry,
i want to inject this to a DDC controller. to set a temperature with a slider. i want to merge this output into a UDP massage.

@Steve-Mcl can your buffer-parser node convert a number into a buffer containing the IEEE float value?

Hi Colin. No, only standard buffer functions (node is Buffer doesn't do IEEE754 AFAIK)

@rogier are you using node-red v1.3.x? If so, you could use this IEEE754 npm module in a function node.

ok thank you, i upgrade Node Red to 1.3.2 and installed the module, have you any idea how the function code must look like? can't find any examples.... :grimacing:

Hi @rogier , i have found this (JavaScript (Node.js) IEEE 754 Single precision Floating-Point (32-bit) binary conversion from and to both Hex and Bin · GitHub) and i put in a function node.

float32toHex.json (1019 Byte)

hello Folgore, Thank You ! this is working.. :ok_hand:

Hi rogier, can you share the node code that worked for you ?

Thank you!