Closed MuthaX closed 3 years ago
While I agree that those results look wrong, I'm not sure your versions are better. Surely the fractional part of -1.80
is -0.80
not 0.2
(current) or -0.2
(yours).
Though that does seem to match the code you posted, which is using floatround_tozero
as I'd expect.
Abstract
The floatfract(Float:value); function is most likely implemented in backend (C) as
Which is incorrect when value is negative. The proper way is (c):
or (Pawn):
Proof/Issue reason
When you try this function at positive values - everything is ok, but at negative values you get:
Note
By definition "whole_value = truncated_value +fractional_value". There is also reason in fact of inaccurate definition of floatfract (it is exist another 2 ways to get fractional part).