Simple Maths

Hey guys,

I understand that division is more expensive then multiplication, addition and subtraction.

What I was wondering was is what is more expensive:

(1 / 10) or (1 * 0.1)

Don’t mind: modern computers (after the jurassic 386) have dedicated math processors, which take the same time to do basic operations. It’s much more important to declare types of all JS variables (an untyped variable must have the type of its contents determined at runtime, which sucks). If you are concerned to performance, take a look at

They know things!

Not exactly a Unity specific question so there is a StackOverflow question on it.

You say divisions are more expensive, so 1 * 0.1 should be faster.

If you want you can easily make a little benchmark yourself.

Just make a very large multiplication and division, loop it a few 1000 times, let it add the time it took to some counter, and show the result in the end :wink: