I wrote myself a custom StrToSingle function using Val, the same thing used for the StrToFloat conversions, and got the exact same result. Honestly I really don't understand how this is happening. As both functions use Val this implicates FPC as having a potentially bad bug, especially where accuracy is required in these routines.
I hope that somewhere it's my fault; that's so much simpler to fix! :?
Code:
function StrToSingle(S: String): Single;
var e: Integer;
f: Single;
begin
Val(s,f,e);
if e > 0 then
LogCritical('Error in StrToSingle! STR = "'+S+'" Error at char #'+IntToStr(E))
else
StrToSingle := f;
end;
Bookmarks