While a 32 bit float accidentally fits into the eax
register, the WriteDec
function expects an integer and hence interprets the bit pattern as such producing unintended output. Floats do not directly map to integers that way.
You should either convert the result to integer or find a way to print floats.
If you are just interested whether you are doing it right use a debugger. The code you posted seems correct, by the way.