0 is not a power of 2

Matthias Bentrup via Digitalmars-d digitalmars-d at puremagic.com
Tue May 19 06:32:51 PDT 2015


On Tuesday, 19 May 2015 at 05:16:48 UTC, Andrei Alexandrescu 
wrote:
> [...], but it wrongly returns true for x == 0.

When we're talking about modulo 2^n arithmetic, 0 is in fact a 
power of two.

Proof: 2^n mod 2^n == 0.



More information about the Digitalmars-d mailing list