-
[RESOLVED] Math.pow(myValue, 2) or (myValue * myValue)?
Does anyone know if there is any significant performance gains/losses when using the methods of the Math class vs. an Operator?
For example, if I'm just trying to square a number, are there any gains/losses in performance if I use Math.pow(myValue, 2) or just (myValue * myValue)?
-
Senior Member
myValue*myValue is more efficient as the Math class does not need to be called up. Plus if the value of myValue is known to the compiler it will probably get preprocessed.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|