Click here to Skip to main content
Click here to Skip to main content

HugeInt - N Digit Arithmetic Class

By , 10 Jun 2010
Rate this:
Please Sign up or sign in to vote.

Introduction

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")
MsgBox(int1^int2)
MsgBox(CStr(int1*int2).Length)

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!

License

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

About the Author

Anshul R
Student
India India
No Biography provided

Comments and Discussions

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