Download

How can I store a very large number?

I’m developing a game that has an economy system. Everything is looking great, but there’s one problem: I can’t store large numbers. Small numbers (smaller than 13 digits) are ok, but larger than that the value is not correct… I tried to use float and double in C++, and I know that all variables have limitations, but I cannot see any solution for my problem.
Can someone help me?

In short: How can I store numbers with more than 12 digits?

It’s relatively easy to create in Unreal a FDecimal struct based on this Intel library.

I’ve done it some time ago, but never updated neither needed the code for other projects.

Yeah you’ll need an external C++ library. Boost has this: cpp_dec_float - 1.66.0

You might want to look at C++ money-handling libraries, though they’ll have extra features like currency conversion etc which you won’t necessarily be interested in.