[fpc-pascal] Possible bug in Numeric test

steveg steveg at nevets.com.au
Sun Feb 28 01:03:32 CET 2016


Drat, that was a bad assumption of mine - sorry

I meant it fails for any of E1 or E2 entries
so any entry beginning with E and then a following number

eg: IsNum('E1');

Sorry for the poor example

On 25/02/16 03:54, Vojtěch Čihák wrote:
>
> 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
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> 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/20160228/900d5271/attachment.html>


More information about the fpc-pascal mailing list