Inefficiency of `mod'

Prof A Olowofoyeku (The African Chief) chief at greatchief.plus.com
Mon Oct 25 16:42:23 CEST 2010


On 25 Oct 2010 at 14:30, Adriaan van Os wrote:

[...]
> Ah, that adds an interesting case, mentioned here
> <http://en.wikipedia.org/wiki/Arithmetic_shift>, namely the arithmetic
> shift right of -1.
> 
> program arithmeticshift;
> begin
>    writeln( -(1 shr 1));
>    writeln( -1 shr 1);
>    writeln( (-1) shr 1)
> end.
> 
> GPC prints
> 0
> 0
> -1
> 
> FPC prints
> 0
> 9223372036854775807
> 9223372036854775807

Delphi (3, 4, 7) prints
0
-1
-1

BP7 prints
0
2147483647
2147483647

Best regards, The Chief
--------
Prof. Abimbola A. Olowofoyeku (The African Chief) 
web:  http://www.greatchief.plus.com/






More information about the Gpc mailing list