Processor power consumption for different functions?
Sorry about the somewhat vague title, title word limit won't let me say much else.
So I'm wondering if anyone here knows about how processor consumptive certain functions are compared to each other.
I'm pretty sure simpler calculations such as addition and subtraction take up much less power than say, finding the square root of pi, but to what scale exactly?
Does finding the square root of a value take a computer 10-20 times more processing power to figure out than something like finding the product between two numbers or is the value pretty much a negligible 2-3 times more processor consumptive?
Just kind of wondering since I'm thinking about how much processing power I can save if I were to do something like measure distance using an imperfect square area
Code:
if actor.Pos.X > self.Pos.X - 100 and actor.Pos.X < self.Pos.X + 100 and actor.Pos.Y > self.Pos.Y - 100 and actor.Pos.Y < self.Pos.Y + 100 then
<insert random code>
As opposed to a perfect spherical distance measuring function
Code:
local curdist = math.sqrt(math.pow(self.Pos.X - actor.Pos.X) + math.pow(self.Pos.Y - actor.Pos.Y))
if curdist < 100 then
<insert random code>
edit: also, do large numbers or numbers with many decimal places take longer to calculate? (e.g 1+1 vs 1.000001 + 1.000001)