If all types of values (ints, floats, etc.) have limitations, how do programs like excel or games calculate numbers higher than these? Do the companies create their own proprietary calculators? Are there standard libraries that handle this?

edit: clarity

有帮助吗?

解决方案

By using "arbitrary precision" math libraries like Gnu MP Bignum Library. These libraries get around physical limitations of the hardware by using algorithms to combine multiple ints, floats, chars etc to represent and operate on a single number.

其他提示

Well, even you could write something simple. Like representing a number as an array of digits and implement all the needed mathematical operations for them. It is slower, of course, than a native machine types, but is does overcome the physical limitations.

And of course there is quite a number of libraries already written. Some are free like GMP, for sure there are some proprietary too. Actually GMP is a dependency of gcc, so I guess you can say its quite popular.

Is is standard? It depends what you mean by standard. It is not defined within the c++ standard. But some are popular (as gnu tools).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top