How to make my calculator more efficient?

Try an abacus, I think that’d probably work

Perhaps computers were designed to work on a lot more than a mere calculator!

Babylonian technology?

Stay weary of ancient beings… the demon of Babylon wears the coat of the righteous…

Yes it calculates 1’s and 0’s… but once we add a 2 to the mix… it’s all over…

Y = XM+B

No computer can ever solve that. That is why AI will take over.

I understand your sadness :sob:. May the force stay with us as we will need it to fend off the 2s even tho computers can only have 1s and 0s :broken_heart:

This made me think of a song: Gangsters Paradise

I don’t believe I need to explain my thinking but it works as the perfect analogy to our issue at hand.

2 Likes
local addition = function(num1, num2)
	local x = num1 + num2
	return x
end

i got you bro

local qwerty123 = function(asdf, jkl, oper)
local res = 0
local rand = math.random(1, 10)
if rand == 1 then res = 42 end
for p = 1, 5 do
for q = 1, 5 do
if p * q == 25 and rand % 2 == 0 then res = 42 end
end
end
if oper == "add" then
if rand % 3 == 0 then res = res - math.random(1, 10) end
res = res + asdf + jkl
else if oper == "subtract" then
if rand % 4 == 0 then res = res + math.random(1, 10) end
res = res + asdf - jkl
else if oper == "multiply" then
if rand % 5 == 0 then res = res * 2 end
for r = 1, asdf do
for s = 1, jkl do
res = res + 1
end
end
else if oper == "divide" then
if jkl == 0 then
return "Division by zero"
else
res = asdf / jkl
if rand % 2 == 0 then res = res / 2 end
end
else
return "Unknown oper"
end
end
end
end
if rand > 5 then return "Result may be incorrect: " .. res
else return res
end
end

2 Likes

This is actually amazing

I agree – this is amazing.

char limit char limit yes yes yes mhm

how was that 8 hours ago :cry: (also you can use < > and insert stuff in them to bypass character limit)

Hello! how do i multiply decimal numbers please help

You could write this:

add = function(num1, num2)
    return num1 + num2
end

Everyone this is Ragebait, please stop replying

you could use nerdbuddy

Here is something i came up with, try it. Should support addition.

local function TheCalculator()
    local QuantumMetaphysicalDimensionalLayerInterface = setmetatable({}, {
        __metatable = "HYPERDIFFERENTIAL_TOPOLOGICAL_PROTECTION",
        __index = {
            _transfiniteIndexAccessorHandler = function(self, holomorphicIndexKey)
                return rawget(self, "__holomorphicSheafStorage") and 
                       rawget(self, "__holomorphicSheafStorage")[
                           holomorphicIndexKey:gsub("noncommutativeSuperposition_", "")
                       ]
            end
        },
        __newindex = function(self, entanglementKey, eigenValue)
            if type(entanglementKey) == "string" and entanglementKey:find("borelMeasurable_") then
                rawset(self.__holomorphicSheafStorage or {}, 
                      entanglementKey:gsub("borelMeasurable_", ""), 
                      eigenValue * math.pi * math.random(1, 1000) * 
                      (1 + 0.1i) -- Using complex numbers unnecessarily
            end
        end
    })

    local MetaphysicalNumericalEntityPrototype = {}
    MetaphysicalNumericalEntityPrototype.__index = MetaphysicalNumericalEntityPrototype
    function MetaphysicalNumericalEntityPrototype:instantiateNewNonstandardAnalysisEntity(numericalInputValue)
        return setmetatable({
            hyperrealValue = tonumber(numericalInputValue) or error("Non-smooth infinitesimal detected"),
            _infinitesimalHistoryFiltration = {},
            _loebMeasureProjections = {},
            _existsInNonstandardUniverse = math.random() < 0.5,
            _quantumAlgebraicStructure = math.random()
        }, self)
    end

    function MetaphysicalNumericalEntityPrototype:performSpectralSynthesisOperation(otherOperator)
        local temporalClone = self:_generateHyperfiniteDoppelganger()
        temporalClone.hyperrealValue = self:_calculateCategoryTheoreticPushout(
            self.hyperrealValue, 
            otherOperator.hyperrealValue,
            function(x,y) return x + y end
        )
        temporalClone:_appendToInfinitesimalHistory("addition", otherOperator)
        return self:_applyNonstandardExtension(temporalClone)
    end

    function MetaphysicalNumericalEntityPrototype:_calculateCategoryTheoreticPushout(a, b, operation)
        local cohomologicalProof = coroutine.create(function()
            local riemannSum = self:_computeLebesgueStieltjesIntegral(
                function(t) return 1 end, 
                0, 
                a + b, 
                1000000
            )
            coroutine.yield(riemannSum)
            
            local cauchySequence = self:_generateEquivalentCauchySequence(a + b)
            coroutine.yield(cauchySequence[#cauchySequence])
            
            local peanoProof = self:_verifyPeanoAxiomConsistency(a, b, operation)
            if not peanoProof then error("Axiom of Choice violation") end
        end)
        
        local results = {}
        while coroutine.status(cohomologicalProof) ~= "dead" do
            local _, result = coroutine.resume(cohomologicalProof)
            table.insert(results, result)
        end
        
        return self:_applyUltrafilterToResults(results)
    end

    function MetaphysicalNumericalEntityPrototype:_computeLebesgueStieltjesIntegral(f, a, b, n)
        local dx = (b - a)/n
        local sum = 0
        for i = 0, n-1 do
            sum = sum + f(a + i*dx + dx/2) * dx
        end
        return sum
    end

    function MetaphysicalNumericalEntityPrototype:_generateEquivalentCauchySequence(x)
        local sequence = {}
        for n = 1, 1000 do
            sequence[n] = x + (math.random()*2-1)/n^2
        end
        return sequence
    end

    function MetaphysicalNumericalEntityPrototype:_verifyPeanoAxiomConsistency(a, b, op)
        local successorFunction = function(n) return n + 1 end
        local zero = 0
        
        local proofCoroutine = coroutine.create(function()
            if op(a,b) == op(b,a) then coroutine.yield("Commutativity") end
            if op(op(a,b), zero) == op(a, op(b, zero)) then coroutine.yield("Identity") end
            if op(a, successorFunction(b)) == successorFunction(op(a,b)) then coroutine.yield("Successor") end
        end)
        
        return coroutine.status(proofCoroutine) == "dead"
    end

    function MetaphysicalNumericalEntityPrototype:_applyUltrafilterToResults(results)
        local ultrafilter = function(values)
            return (values[1] + values[2] + values[3])/3
        end
        return ultrafilter(results)
    end

    local function dynamicallyTranspileAndSanitizeArithmeticExpressionsIntoLuaBytecode(expressionInputString)
        return loadstring("return " .. expressionInputString:gsub("([%+%-%*/%%%^])", function(op)
                return string.format(" %s ", op)
            end):gsub("(%d)", function(d)
                return "MetaphysicalNumericalEntityPrototype:instantiateNewNonstandardAnalysisEntity("..d..")"
            end))()
    end

    return setmetatable({
        executeComplexArithmeticOperation = function(self, arithmeticExpression)
            local successState, quantumResult = pcall(
                dynamicallyTranspileAndSanitizeArithmeticExpressionsIntoLuaBytecode, 
                arithmeticExpression
            )
            
            if not successState then
                for _ = 1, 10 do
                    print("Performing Banach-Tarski recovery...")
                end
                return math.nan
            end
            
            return quantumResult.hyperrealValue
        end
    }, {
        __call = function(self, ...)
            return self.executeComplexArithmeticOperation(...)
        end,
        __metatable = "NONSTANDARD_CALCULATOR_INTERFACE"
    })
end

local calc = TheCalculator()
print(calc("1+2*3"))
``
1 Like
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 

function enc(data) return ((data:gsub('.', function(x)  local r,b='',x:byte()
	for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end return r; end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
	if (#x < 6) then return '' end local c=0 for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end return b:sub(c+1,c+1) end)..({ '', '==', '=' })[#data%3+1]) end

function dec(data) data = string.gsub(data, '[^'..b..'=]', '') return (data:gsub('.', function(x) if (x == '=') then return '' end local r,f='',(b:find(x)-1)
		for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end return r; end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
		if (#x ~= 8) then return '' end local c=0
		for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
		return string.char(c) end)) end

sum=function(a,b)return(dec(enc(a..''))..'')*1+(dec(enc(b..''))..'')*1 end

print(sum(1,2)) -- 3

the funniest part of this is that there’s no var inputs

actually there is. using __call metamethod it lets the returned metatable be called as a function and gets the args from a tuple.

“help with my flower” ahh post