Skip to content

Commit a255644

Browse files
committed
update nan display
1 parent b4c62b2 commit a255644

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

big-num/bignumber.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ function Big:normalized()
4545
return self
4646
end
4747

48+
function Big:isNaN()
49+
if not self.m or not self.e then return true end
50+
if tostring(self.e) == "nan" or tostring(self.m) == "nan" then return true end
51+
end
52+
4853
function Big:add(b)
4954
if type(b) == "number" then b = Big:new(b) end
5055
local delta = b.e - self.e

big-num/notations/Balatro.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ function BalaNotation:format(n, places)
2525
end
2626
return string.format(num ~= math.floor(num) and (num >= 100 and "%.0f" or num >= 10 and "%.1f" or "%.2f") or "%.0f", num):reverse():gsub("(%d%d%d)", "%1,"):gsub(",$", ""):reverse()
2727
end
28+
if n.isNaN and n:isNaN() then
29+
return "NaN"
30+
end
2831
--The notation here is Hyper-E notation, but with lowercase E.
2932
if to_big(n:log10()) < to_big(1000000) then
3033
--1.234e56789

0 commit comments

Comments
 (0)