Discussion:
Attn. Florian, r39759
(too old to reply)
Bart
2018-09-17 20:56:20 UTC
Permalink
Hi,
optimize (v>=x) and (v<=y) into (v-x)<(y-x)
If the commit does what this says, it is incorrect for the case that x=v=y:
(v>=x)=true, (v<=x)=true, (v-x)<(y-x) translates to (0<0) wich is false.

See https://bugs.freepascal.org/view.php?id=34292
--
Bart
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/
Joao Schuler
2018-09-17 21:11:59 UTC
Permalink
Assuming: v=1; x=10; y=3

(v-x) < (y-x) == (1-10) < (3-10) == -9 < -7 == *true*

(v>=x) and (v<=y) == (1>=10) and (1<=3) == false and true = *false*
Loading...