Bug in ^^

jmh530 john.michael.hall at gmail.com
Tue Sep 17 02:38:03 UTC 2019


On Tuesday, 17 September 2019 at 01:53:12 UTC, Brett wrote:
> 10^^16 = 1874919424	???
>
> 10L^^16 is valid, but
>
> enum x = 10^^16 gives wrong value.
>
> I didn't catch this ;/

10 and 16 are ints. The largest int is 2147483647, which is 
several orders of magnitude below 1e16. So you can think of it as 
wrapping around multiple times and that is the remainder: 1E16 - 
(10214748367 + 1) * 4656612 = 1874919424

Probably more appropriate for the Learn forum.


More information about the Digitalmars-d mailing list