ARTICLE

Big Integer in .NET 4.0

Posted by BALAMURUGAN ALAGUMALAI Articles | C# Language October 13, 2009
This article introduces Big Integer added to .NET 4.0 and C# 2010.
Reader Level:


In .Net 4.0, we have a new feature called Big Integer. Any values which can't hold by double or long can occupy by Big Integer.

BigInteger is there in System.Numerics.BigInteger.

Double can hold 16 bit values but Biginteger can hold any values. Let see the comparsion of Big Integer and Double.

Example:

System.Numerics.BigInteger biginteger = System.Numerics.BigInteger.Pow(2, 128);

Response.Write("BigInteger" + biginteger.ToString("N"));

Response.Write("<br>");

Response.Write("Double" + Math.Pow(2, 128).ToString("N"));

Response.Write("<br>");


Output:

BigInteger340,282,366,920,938,463,463,374,607,431,768,211,456.00
Double340,282,366,920,938,000,000,000,000,000,000,000,000.00

Handling very big values can be possible in .NET.

Login to add your contents and source code to this article
post comment
     

nice article


Posted by Master Billa Oct 25, 2009
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.