'percentage calculation with negative integers LUA [ANWSERED]

problem:

-4% = 0
0% = 5000

How do I make it so that i can calculate both the negative and positive values?

What i've tried:

local nrstate = "-"
local x = thermalpower
if thermalpower < 5000 then
    x = (x/3200) * 100
    nrstate = "-"
    elseif thermalpower > 5000 then
    x = (x/10000) * 100
    nrstate = "+"
end

thx in advance for any answers

lua


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source