Just wanted to know... is there any variable in C++ that can hold larger numbers than unsigned long long int , or is it the largest variable?
Thanks in advance :P

Recommended Answers

All 10 Replies

If you can't fit the value into a long int or a long double (or long long, if your compiler supports), you need some kind of arbitrary length arithmetic type, which isn't native to C++.

I see... so, are there some classes that people made for huge numbers handling?
I like working with big numbers :P

Member Avatar for iamthwee

Tell us what compiler/ide you are using?

But the following link would be the obvious choice.

http://gmplib.org/

If you want to switch to Java it supports the Big Int class... but there is nothing bigger that I know of in C++.

Tell us what compiler/ide you are using?

But the following link would be the obvious choice.

http://gmplib.org/

What's IDE?
I'm using Dev-C++ (version 4.9.9.2 if it helps...)

>so, are there some classes that people made for huge numbers handling?
Yes. I would recommend GMP as well.

>I like working with big numbers
It should go without saying that using such a library is extremely likely to be slower than built in types. If you don't need big numbers, don't bother. I say this because I've caught people using BigInt when the value never exceeded int and there was no foreseeable increase in the necessary range.

What's IDE?
I'm using Dev-C++ (version 4.9.9.2 if it helps...)

That's IDE. :)
IDE stands for integrated development environment.
Best to describe it as a compiler and a lot of useful stuff that comes with it, almost always including specific text editor.

Just imagine that all your numbers are scaled. For example, let 1 is equal to 1 billion, 2 == 2 billions and so on (append nine zeroes when printing)...
What's a pleasure to summarize very BIG numbers with short int arithmetics: no need in GMP and other stuff...
;)

Unless you absolutely need to know those 9 digits that are missing... but that rarely ever happens :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.