Is it possible to use negative exponents?

I am currently trying to port an equation to roblox but I need to use negative exponents, but as in just negative numbers, but like the dividing exponent. How do I do that?

1 Like

Like:
x - the base
y - exponent
x / (x * y)

Is that what you want?

1 Like

Do you mean something like

5^(-1)

?

3 Likes

If you’d like to use for example as the exponent in your equation you can use this method:

2^(1 / 3)
1 Like

According to the law of exponents, it says that a negative exponents has this formula,


(n1 is base, n2 is exponent)

n1^-n2 = 1/n1^n2

So we could use this law to make a function that works out

function neg_exp(n1,n2)
    return (1/n1^n2)
end

Exponents Law 101

Hope this helps!

or you could just use the solution below

heres a F key(idk why) F

1 Like

Lua supports negative exponents.

print(math.pow(2, -3)) -- 2 to the negative 3, prints 0.125

This goes back to radicals

2^1/3 is equivalent to the cuberoot of 2.

1 Like

It is the cube root of 2 :grin:

Since Luau doesn’t have a math.cbrt function it’s what you need to do to calculate it

1 Like

Or, we can start a petition for math.cbrt
image

2 Likes

I totally forgot about this topic lol but apparently I did actually get the exponent thing right, but the equation just didn’t work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.