A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Math.pow(myValue, 2) or (myValue * myValue)?

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jan 2006
    Posts
    133

    resolved [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)?

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    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.
    New sig soon

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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center