Heya, following up on this - could you publish this to Wally, as that would be useful for many people wanting to use libraries as such.
My bad, just realized it a bit back.
I’d also like to append a feature request here: would be cool to have bitwise operator support for InfiniteMath, I can see this especially useful in cryptography.
1.3.3 is here, very small update to fix an error.
- Fixed an error with
round
between 1e+100 and 1e+299
Ok should have look around a little more haha, 1.3.4 here with another tiny fix
- Improves
Reverse
by removing string usage, and instead solving the scientific notation equation ({5, 7} = 5 * 10^7 = 50000000). This fixes an error with very small decimals that use e-.
1.3.5 is here, with performance improvements thanks to Native Code Gen
- Marks the module as native (with
--!native
) to increase performance.
Using this function before this update will take approx 2.6201
seconds. After this update it takes approx 1.6117
seconds (38.48% improvement). Certain functions are impacted more than others (only using new
results in an 8.45% improvement)
local IM = require(game.ReplicatedStorage.InfiniteMath)
local ticker = tick()
for i = 1, 100000 do
local Num = IM.new(i)
Num *= i
Num ^= i
Num = IM.round(Num)
end
print(tick() - ticker)
Currently, you need to enable the Luau Native Code beta to see the effects, and live servers will not be impacted.
1.3.6 is here. This update fixes a few bugs.
-
Fixed an issue with
InfiniteMath.new()
where strings such as"1e+5"
or"50000"
would error. -
Fixed an issue where if
DECIMALPOINT
cuts off the decimal of a number display such as10.00025
, it would display with zeros after the point, like10.00
. If the decimal of a displaying number (usingGetSuffix
) is equal to 0, it will be removed.10.00
turns into10
. -
Fixed an issue where super low decimals that get turned into Scientific Notation, such as
5e-5
which equals0.00005
would cause multiple errors.
I’m sorry but you seem to have made a misleading and very minor mistake. 10^10^308 is vastly different from 10^^308. 10^^308 is actually 10^10^10^…^10 308 times in total.
10^^308 in full length:
10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10^10
(a tad bit larger than 10^10^308)
The limit actually is 10^^308 (10^10^10…^10 308 times.)
local IM = require(game.ReplicatedStorage.InfiniteMath)
local Num = IM.new(10)
for i = 1, 308 do
Num = Num^10
end
print(Num.first, Num.second, Num)
This code prints the coefficient, the exponent, and the scientific notation of the number.
1 9.999999999999998e+307 1e+99.99UC
is the print, coefficient is 1 and exponent is basically 1e+308.
I don’t believe I say the limit is 10^10^308 anywhere, unless I missed it when I was replacing it with 10^^308. Can you let me know where it says 10^10^308?
My bad. I guess I was thrown off at the start by
It doesn’t directly state 10^10^308 but I pretty quickly assumed that’s what you were referring to.
Ah its okay, at one point the post said it was 10^10^308 before I learned its actually 10^^308, so I thought it might still say that somewhere.
1.3.7 is here with some bug fixes!
-
Fixes the
.00
fix not working withDECIMALPOINT
not being 2,.000
or .0
will now be fixed just like.00
. -
Fixed
.99
showing up at the end of numbers that are very close to being whole. For example5
might be stored as4.99999999999523525
, displaying as4.99
(decimal amount depending onDECIMALPOINT
), numbers ending in a decimal very close to1
will now be rounded up.4.99999999999523525
will display as5
. -
Fixed numbers below 1 not using
DECIMALPOINT
in:GetSuffix()
. -
Fix C stack overflow error when using
.__concat
with an InfiniteMath number as the second parameter -
Improved
pow is not a valid power
error for.__pow
, the error now explains that if your power isinf
you need to keep it below10^308
.
1.3.8 has been released with some more fixes/improvements, and a new doc on using datastores with InfiniteMath.
-
Fixed a bug with very small numbers (that get stored as scientific notation, like
1e-15
) displaying incorrectly. -
Improves
InfiniteMath.round()
, reduces cases of incorrectly picking ceil or floor over the other. -
Added a new Datastore Implementation page to the docs website.
-
Corrects a mistake in the Suffixes module, QNV (Quinvigintillion) was instead QNT, even though there is already QNT (Quattuornonagintaducentillion).
-
Improves some type checking that was added
1.3.7
,.new()
no longer throws a warning with tables or InfiniteMath numbers.
Thank you! Finally I can do my astro physics homework in Roblox
Tbh I like the concept of it but I still prefer EternityNum (Old) by @FoundForces because it’s useful for games and I don’t need to code in suffixes because it’s already preset to 1e(1.78*10^308) and plus it’s easy to learn.
I’m confused what you mean by “code in suffixes”. Do you mean you want to be able to display numbers in scientific notation? The module has plenty of documentation so its very easy to learn as well.
1.3.9 is out with more fixes and a new function, SetValue!
-
Fix comparisons not correctly comparing negative and positive numbers.
-45 > 0
would returntrue
, this would impact comparison and any function that used it (min, max, clamp, etc.). It now correctly returnsfalse
. -
Adds a new :SetValue() function. This sets the value of a constructed number, which is better practice than creating a new number with a different value as it doesn’t need to create new metatable (better for memory I believe). The function takes a new
first
andsecond
and sets thefirst
andsecond
of the constructed number to the new values. -
Fixed an error with
:ConvertFromLeaderboards()
when given 0. -
Fixed an issue with
:aaNotation()
where instead of using z it would use scientific notation.
idk if you answered it, but if you have 1e+2M cash
will it be actually 1 with 2M zeros?
Short answer, yes.
Long answer, we store the coefficient and exponent of the number, to store 1e+2M we would just store {1, 2000000}. The modules arithmetic is built to work with the coefficient and exponent being separated, so we can do math still. So even if we’re storing 1 and 2M, we mathematically have 1e+2M.
1 iotaCoin pls; magic!! Anyway it is needed that we have limits in