[Lazarus] floating point mask

waldo kitty wkitty42 at windstream.net
Tue Dec 8 05:50:09 CET 2009


sorry but what is the code below supposed to be showing??

Alexander Klenin wrote:
> On Tue, Dec 8, 2009 at 03:49, David Emerson <dle3ab at angelbase.com> wrote:
>> Of course, if you have a set of all the valid characters
>> ['-', '.', '0'..'9', 'e', 'E', '+'], it's not unreasonable to restrict
>> characters outside that set. But make sure the set is complete-- at
>> first I overlooked "e+" which is valid for val (string, real)
>>
> 
> No, it is not:
> 
> t.pas
> ---
> var
>   x: Double;
>   d: Integer;
> begin
>   Val('e+', x, d);
>   Writeln(x, ' ', d);
> end.
> ---
> dcc32 -cc t.pas
> t.exe
> ==>
>  0.00000000000000E+0000 3
> ---
> fpc t.pas
> t.exe
> ==>
>  0.00000000000000E+000 1
> 
> So both Delphi and FPC reject 'e+' as a floating-point value,
> although with different error positions.
> The latter is probably a compatibility bug in FPC's Val procedure.
> 





More information about the Lazarus mailing list