string.format issue

i am trying to use string.format("%x", -27.461678) to change the number to hex but it doesnt work, any idea why?

local string = require “string”

string.format("%x", -27.461678)

I think I managed to confuse myself very well, let me tell you what i want to do, i want to change float i.e. -27.461678 to hex, whats the best way to do it?

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.