Jump to content
  • Advertisement
Sign in to follow this  
KorangarDev

Weird simple CSharp math issue.

This topic is 2418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a weird bug!
The line

Console.WriteLine(2^32);
Console.WriteLine((uint)2^32);

both show the result is 34...
And that's basically my entire program.

I ran a loop for each possible number for i from 32 down and did 2^i.
34
29
28
31
30
25
24
27
26
21
20
23
22
17
16
19
18
13
12
15
14
9
8
11
10

Thoughts?

Share this post


Link to post
Share on other sites
Advertisement
Note that exponential is generally written ** (double asterisk) in programming languages, if it is defined at all (Python supports it, for instance).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!