Solved

C# Large numbers

Posted on 2006-06-23
3
299 Views
Last Modified: 2008-01-09
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
Comment
Question by:UnexplainedWays
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 16974317
please try this:
16777216m * 202m
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16974329
           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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now