Click here to Skip to main content
13,457,673 members
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 10 Jun 2010

HugeInt - N Digit Arithmetic Class

, 10 Jun 2010
Rate this:
Please Sign up or sign in to vote.
A class for N-Digit Arithmetic


HugeInt Class is like any Integer Class(only +,-,*,^ are supported) but can hold any number of digits.

Using the Code

HugeInt can be used like this:

Dim int1 as New HugeInt.HugeInt("2")
Dim int2 as New HugeInt.HugeInt("4096")

Keep in mind that this class is not designed for high-speed arithmetic. My aim was to develop logic in basic n-digit arithmetic.

A Factorial function or Permute or Combine function can also be included. But I thought the basic functions would be enough for logic.

This class will be very useful for computations of Combinations or Permutations or 1000!(factorials) or big exponents(10^10000). Every digit of the given integer is accurate.

Internally, it uses a string array for the digits. So the precision is upto the nth digit.

Points of Interest

First, I tried to convert an N-Digit number to Binary format. But I couldn't develop a good method other than dividing and getting the remainder(if there is a good method, please let me know.)

A Case-By-Case Analysis of what our human brain does for various types of subtraction(borrows, first digit etc.) was interesting and I learnt how complex the brain is!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Anshul R
India India
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180322.1 | Last Updated 10 Jun 2010
Article Copyright 2010 by Anshul R
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid