-
I apologize for the duplicate thread, I already posted this in General Help before I saw this forum. Here goes:
Hi everyone. My math is a little rusty these days. I notice that Flash can compute natural logarithms, but I need to compute a base 10 log. I imagine this could be accomplished using the functions and constants in Flash, but I'm sort of lost. Can anyone give me a hand?
Or, does anyone else know other good tricks to determine the order of magnitude of a number?
-Jon
-
Gross Pecululatarian
I can't personally help, but try searching the Flashcoders archives, it's quite likly to have somthing:
http://chattyfig.figleaf.com/search.php
-
madskool.wordpress.com
-
Yeah.
Code:
log e a ln a
log n a = --------- = -------
log e n ln n
log e x = ln x = Math.log(x)
Good luck,
Martin
Last edited by Somar; 10-14-2002 at 11:08 PM.
-
As a Math function:
Code:
Math.logBase = function (num, base) {
if (base == undefined) base = Math.E;
return Math.log (num) / Math.log (base);
};
// test
trace (Math.logBase (1000, 10)); // 3
trace (Math.logBase (.001, 10)); // -3
trace (Math.logBase (256, 2)); // 8
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
|