[fpc-pascal] Currency and ABS(-674.59)

Jeppe Græsdal Johansen jjohan07 at student.aau.dk
Sun Mar 4 23:10:00 CET 2012


Den 04-03-2012 22:31, Zaher Dirkey skrev:
> I found this problem in Delphi and FPC, please test it and confirm if 
> it is a bug.
>
> -------------------
> program test_abs_curr;
> uses
>   sysutils;
>
> var
>   a: Currency;
> begin
>   a := 674.59;
>   if a<>abs(-a) then
>     writeln('not equal')
>   else
>     writeln('equal');
>
> end.
> -------------------
>
> I am using last reversion of Lazarus, FPC 2.6
>
> Best Regards
> Zaher Dirkey
>
I get "not equal" for i386-win32, however with the following program I 
get "equal"

program test_abs_curr;
uses
   sysutils;

var
   a,b: currency;
begin
   a := 674.59;
   b := abs(-a);
   if a<>b then
     writeln('not equal')
   else
     writeln('equal');

end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120304/4e7b8002/attachment.html>


More information about the fpc-pascal mailing list