John White
John White

Reputation: 161

32-bit fixed point overflow

I'm doing some 'early computing' on a 32-bit Windows PC, and looking at the limits.

Now, 2**32 is 4,294,967,296, and I find that

4294967290 + 5  

is perfectly OK, and

    4294967290 + 6 

quite properly overflows.

What puzzles me is that

   429496729 * 10

overflows, although the product, 4294967290, is in range.

Anyone interested?

Upvotes: 4

Views: 844

Answers (1)

GSerg
GSerg

Reputation: 78185

In the absense of any code, I'd guess 429496729 gets implicitly typed as signed integer, for which 4294967290 is too much.

Upvotes: 4

Related Questions