Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-07

Re: fpc-devel Digest, Vol 99, Issue 3

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Max Nazhalov
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+1792

Surely, 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

Reply by email