you wrote 26 lines
At 18:24 20-8-2003, you wrote:
>On Wednesday 20 August 2003 16:56, you wrote:
> > > > Hallo,
> > > > i'm newbie and maybe making something wrong.
> > > >
> > > > Small example for go32v2:
> > > >
> > > > var q1,q2:qword;
> > > > begin
> > > > q1:=10;
> > > > q2:=20;
> > > > writeln(Abs(q1-q2));
> > > > end.
> > >
> > >I get runtime 215 with FPC 1.0.6 ...
> > >
> > >This probably means that FPC cannot support qwords in the abs function
> > >even though the documentation says "Any numerical type".
> >
> > The problem is that there is a abs(int64) and abs(cardinal) and it
> > can't decide which to take. An abs(qword) needs to be added
>
>IMHO, abs(cardinal) doesn't make any sense .. calling it could even be
>considered a design or coding error, couldn't it?
Then abs(qword) also doesn't make any sense
True. So I think the best way is either to declare
var q1, q2: int64;
or, if they have to be qwords for some reason, to typecast:
writeln(abs(int64(q1) - int64(q2)));
Still, the documentation states "any numerical type". If there's time for it, FPC should imho generate a call to abs(int64) and possibly issue a warning when it encounters abs(qword).
Anton
----------
Ing. Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
phone: +43 1 218 97 59
email:
----------
"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben."
Doris Langley Moore: Ada, Countess of Lovelace (London 1977).
----------