System: XP pro on virtualbox
Compiler\IDE: fpc 2.2.4
API: OpenGLes (mbx lite)

I am trying to convert floating point values to integer. I need that because i need to support hardware that does not support floating point values.
For now i use the following function:
[code=pascal]function f2vt(value: single): integer;
var
temp: integer;
begin
temp := integer( single(value) * single(65535));
writeln(integer(temp));
result := integer(temp);
end;[/code]

But the results are all wrong for negative numbers.
if i feed -0.4 i get: -2147457434 (i expected -26214)
if i feed 0.4 i get: 26214 (correct)