| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
help with gigantic numbers
i need to store values that are <= 1e10
unfortunatly the largest datatype that I know of, unsigned long long, can only hold up to about 2e9. Are there any larger data types? |
|
#2
|
|||
|
|||
|
Do you need to store integers or floating point numbers?
-KM- |
|
#3
|
|||
|
|||
|
integers and they can be unsigned. it would work if they were floating too though it doesn't really matter
|
|
#4
|
|||
|
|||
|
There are no data types that can handle such big numbers but it is possible to write your own number handler (or use an existing library of course). This requires adding a datatype that will hold your binary representation of the number and then functions to carry out the standard operations that you will require such as addition and multiplication. Depending on your efficiency requirements there are a number of fantastic optimizations that can be implemented (look up montgomery arithmetic for starters).
Unless this is part of an assignment where you need to show you can write the number handler yourself then I suggest using an existing one though since all the hard work will have been done for you and you can just make use of it. -KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > help with gigantic numbers |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|