Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

C# Large numbers

I'm trying to do this equastion: http://www.hackingspirits.com/cyb_forensic/fsic_articles/loc_place.html

However i keep getting a "The operation overflows at compile time in checked mode";

All are ok except for 16777216*202.  I've tried a few things, like doubles, ints longs and tried to make them unsigned aswell.  Is there a way to handle such large numbers?

If there isn't a standard .net way, my guess is i have to create my own class and catch how much overflow there is?
0
UnexplainedWays
Asked:
UnexplainedWays
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please try this:
16777216m * 202m
0
 
UnexplainedWaysAuthor Commented:
           uint aaa = 202;
            uint bbb = 16777216;
            IP_Number = aaa * bbb;

It took the 202 and left it as a normal int.

I tried the m, it turns the numbers into a decimal, and if i turn the origional number into a decimal that works 2.
Thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now