What Is Bignum?
Bignums are integers that are too big for standard value types. These integers are used in many mainstream programming languages, but they're limited to a maximum value of 2,147,483,647 (2^31 - 1). This means that if you want to use an integer with a more considerable value than that, you need a different kind of data structure for it. Bignums are used to store numbers that are too large for the standard integer data type. They're represented in memory as a sequence of bytes in little-endian order. They can be created with the new BigInteger(String) constructor or by calling one of several static factory methods on BigInteger. You can think of bignum as the opposite of binary. Where binary uses base-2 numbers, bignum uses base-10. It's a bit more complicated than that, though. In computer science, we have to deal with the fact that computers cannot store every number in their memory. So when you do the math on your computer, it has to do fancy footwork to ensure that you're given an accurate answer. Computers deal with this by using a special type of number called a floating point number (or float). A float is a numerical value stored about 6 digits after the decimal point. That means it can only represent numbers between -1 and 1 without error. It could be better for storing very big numbers! Bignums are big numbers that cannot fit into a float; they require many more digits after the decimal point to store them accurately. Because of this, languages like Ruby must use special algorithms to convert them into machine language so they can perform math operations on them accurately. The great thing about floating point operations is that they're very good at representing huge integers. The bad thing about floating point operations is that they could be more accurate at representing very large integers. Floating point operations are also used to describe very small integers in computer systems, but we don't talk about those because they're boring.
Related Terms by Software Development
Join Our Newsletter
Get weekly news, engaging articles, and career tips-all free!
By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.

