numeric values bigger than ULLONG_MAX

百般思念 提交于 2019-12-24 02:06:52

问题


I need to store and use numeric values bigger than ULLONG_MAX.

I will need to make arithmetic operations with those values, so I think store as char** is not a option.

Is there a way to dynamically create an additional long prefix in those cases?


Thank you all. Based on responses, Very helpful but I doubt about the best performance option. piokuc quote a performance link, but it's unclear. In this time I'm between GMP or MPIR, there is some one faster?


回答1:


You need to use one of the arbitrary precision arithmetic libraries, like GMP, see also What's the best (for speed) arbitrary-precision library for C++?




回答2:


In addition to multi-precision libraries such as GMP, if you are using GCC on a 64-bit architecture, you also have the option of using __int128 (documentation).



来源:https://stackoverflow.com/questions/18056764/numeric-values-bigger-than-ullong-max

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!