[fpc-pascal] Severe bug (?) dividing comp variables in 3.0.0
greim
greim at schleibinger.com
Wed Jun 29 16:56:39 CEST 2016
Hi,
there seems to be a very strange effect with dividing comp variables in
3.0.0:
Dividing a comp variable x by any number which is not 1 or x gives result 0.
Tested on a i386 machine.
It works fine with for example with fpc 2.6.4.
I know I can use int64 instead, but we have a lot of very old, but
reliable, code around.
Example below.
Regards
Markus
--------------------------------------------------------------------------
PROGRAM compbug300;
VAR x1, x2 : comp;
(* Dividing 8 / 2 doesn't work with fpc 3.0.0
but works for example with fpc 2.6.4
Markus Greim / 29.jun.2016 *)
BEGIN
x1 := 8;
writeln('x1 : ',x1);
x2 := x1 / 2;
writeln('x2 = x1/2 should be 4 but is : ', x2);
x2 := x1 / 4;
writeln('x2 = x1/4 should be 2 but is : ', x2);
x2 := x1 / 8.0;
writeln('x2 = x1/8.0 should be 1 and is : ', x2);
END.
More information about the fpc-pascal
mailing list