Trouble with big numbers

i want to make a function to abbreviate numbers like 9M and 287Sxt

i made the code but because roblox converts big numbers like 9999999999999999999 to stuff like 1e+15 it breaks it for some reason and makes it turn 9999999999999999999999 into 10Sx when it should be 9.999999999999999999999Sx

local Math = {}

local exp = {'K','M','B','t','q','Q','Sx','S','o','n','d','U','D','Tr','Qtd','Qud','Sxd','St','Od','Nvd','Vt','Uvt'} 
Math.abr = function(x)
	if x < 1000 then return tostring(x) end
	local n = math.ceil(math.log10(x))
	local i = math.min(#exp,math.floor((n-1)/3)) 
	local v = i*3
	local p = 10^v
	local f = x/p
	print(x,n,i,v,p,f)
	return tostring(f)..exp[i]
end

return Math 

Does anyone know if theres a way i can get around this?

This is how I am adding suffixes. Try this, you can increase its range according to your use.

local Suffixes = {'','K+','M+','B+','T+','qd+'}

local function AddSuffix(Amount)
	for i = 1, #Suffixes do
		if tonumber(Amount) < 10^(i*3) then
			return math.floor(Amount/((10^((i-1)*3))/100))/(100)..Suffixes[i]
		end
	end
end