0

Hello Daniweb,
What would you guys say is the most effective way to manage memory for powers?

I'm thinking for smaller powers, like squares or something, it's probably just better to do x * x and Math.pow(x, 2) should only be used for bigger powers.

I have a lot of those calculations in a single file so was just wondering what the best way to approach it would be.

Cheers!

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by bloodbender
0

Math.power ends up in a native method to do the actual calculation, so its a reasonable bet that's its very efficient indeed. Either way. memory really doesn't come into it.
Unless your idea of "a lot" runs into millions in this case, I wouldn't waste another millisec worrying about speed or memory for Math,power.

0

It for sure doesn't run into millions, but I do see your point with native functions v.s. external.

Cheers mate! Gonna mark this as solved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.