Why we should use the FastMath?

I was thinking the FastMath will give better performance.
So when I was going to calculate the square of one variable, I used FastMath.sqr().

However, when I looked into the source code, the method just returns fValue * fValue…

Is it going to be more effective in the future?

Well, I certainly hope that sqrt() isn’t returning fval * fval as that would be the opposite of what it’s supposed to be doing.

FastMath may have some faster methods (some will just call Math.* routines). It may have some methods that Math doesn’t have. It definitely returns floats instead of doubles so that you don’t have to cast everywhere.

No need to overthink it, really.

Sorry, i made a mistake,it is sqr() :stuck_out_tongue_closed_eyes:

I think of it like a JmeMath class which provides you with more useful things for doing 3D maths that the normal Math class doesn’t provide and I hope it’s “fast”, relatively speaking :smiley:

Usually it has only float accuracy,
also it has some really useful constants for fast degree to radian ect conversions.