Show quoted text 19 lines
Hello,
i think i've found a bug in the procedure TryStrtoFloat.
To get this bug, create a new project and run this lines (i'm using a
button to run the line, but it shouldn't matter)
---------------------------------------------------
var
areal:real;
begin
TryStrtoFloat('86E6722INVALID!',areal);
end;
---------------------------------------------------
"86E6722" is a valid number, which is out of range and creates an error.
The whole text is not a valid number, but it also creates an error.
It raises an "External: SIGFPE" error.
B.t.w.: "TryStrToInt('86E6722INVALID!',aint);" or
"TryStrToInt('86E6722',aint);" raises no error, they just return false.
Confirmed. r21354, Win32.
EOverflow: Floating point overflow
$00404BF1 fpc_val_real_shortstr, line 1484 of C:/prog/FPC_SRC/rtl/inc/sstrings.inc ...
Quick investigation showed the following:
source line #1484: fpc_Val_Real_ShortStr:=fpc_Val_Real_ShortStr*hd
here: "fpc_Val_Real_ShortStr" is 8.6000000000000000E+4931, and "hd" is 1.00000000000000000E+1792Surely, You should file this case to Mantis.
BTW, reverting r20705 ("{ Calculate Exponent }" section) fixes the problem on x86, but possibly introduces problems on other platforms (see r20705 description)..
Alternate way is to mask overflow exception within fpc_Val_Real_ShortStr, I suspect.
Best regards,
Max
