[fpc-pascal] Possible bug in Numeric test

Vojtěch Čihák vojtech.cihak at atlas.cz
Wed Feb 24 18:24:42 CET 2016


I tried your function in FPC 3.0.0 in mode ObjFPC and it returns False for string 'E1/E2/etc'.
 
V.
______________________________________________________________
> Od: steveg <steveg at nevets.com.au>
> Komu: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
> Datum: 24.02.2016 00:57
> Předmět: [fpc-pascal] Possible bug in Numeric test
>
Not sure if this is considered a bug or not :)

I have found this function returns TRUE if passed 'E1/E2/etc'
I am guessing it is seeing the 'E' as exponent


function IsNum( const sSrc :string ) :boolean;
var
   Code :integer;
   Num :real = 0;
begin
   Num := Num;
   Val(sSrc, Num, Code);
   Exit( Code = 0 );
end;

Thanks - SteveG
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160224/008d9451/attachment.html>


More information about the fpc-pascal mailing list