You might want to look at:
stackoverflow.com/questions/188 … n#19996852
Then you can use it like that:
string.format("0x%x", float2hex(-27.461678)))
Note that it is quite likely that other way to do it exists, this one seems to produce valid results.