This term is used in more complicated math, called a “reciprocal”. It gets the complete opposite of a number, usually used for inverting graphs’ gradients or other scalar calculations.
This is an example on what these numbers’ reciprocals are:
My question is, how can I do this in Roblox? I couldn’t find the answer anywhere. If you have any suggestions or solutions, then please comment it down below. Thank you.
Yeah, this is possible but it’s outside of my skill level. Though it is possible, I just don’t know how to get an integer.
local x = 0.2 --how do we know this is 1/5?
--we can see how many times it goes through one.
local int, decimal = math.modf(x)
local timesItGoesIntoOne = 1/decimal
local reciprocalOfTheFraction = -timesItGoesIntoOne --this is all we need for 0.2
print(reciprocalOfTheFraction) --> -5
--local reciprocalOfTheDecimal = -(timesItGoesIntoOne+(int*timesItGoesIntoOne)) --this is probably wrong, and I'm not sure how to do this.