Page 1 of 1

huge numbers

Posted: Thu Apr 07, 2016 12:13 pm
by soullessbr
Hello people, can someone show me how to work with those giant numbers that use idle games?

ty! :cool: :cool: :cool: :cool:

Re: huge numbers

Posted: Thu Apr 07, 2016 1:24 pm
by Sulunia
Image

I'll just assume you want to print to console or game window a huge number without scientific notation. Then, i guess that would be:

Code: Select all

love.graphics.print(string.format("%.0f", variable))

Re: huge numbers

Posted: Thu Apr 07, 2016 1:31 pm
by Tanner
You'll want to use a library that represents those numbers as a combination of Lua primitive values. Something like this: https://bitbucket.org/tedu/bigintlua/src/tip/bigint.lua

Re: huge numbers

Posted: Fri Apr 08, 2016 3:01 pm
by zorg
If your huge numbers are "whole", that is, they have nothing after a decimal... point, comma or whatever symbol you might use, and they fit inside the double datatype lua (and löve) uses (that is, if the numbers are smaller than 2^53, or 9 007 199 254 740 992) then use what Sulunia suggested, otherwise you can use what Tanner linked.