Math.log10 is not a function??

benjisugar's icon

Hey all,

I'm trying to execute Math.log10() in javascript and I get an error saying Javascript TypeError: Math.log10() is not a function. Standard Math.log() works smoothly. Any ideas what could cause this?
Thanks in advance.

Christopher Dobrian's icon

Math.log10 is a legitimate function of the JavaScript math library, but I confirm that it doesn't work for me in Max (7.0.3 32-bit, MacOS 10.8.5). As you probably know, this does work:
function log10(f)
{
    return Math.log(f)/Math.log(10.);
}

benjisugar's icon

Thanks for the workaround Christopher, my maths is a bit rusty, this works like a charm.
For future readers, my specs are Max 7.0.0 on Windows 8.1.

Christopher Dobrian's icon

Oops. I had an extra ')' in my JavaScript above. I've corrected it.

Emmanuel Jourdan's icon

Math.log10 will be legitimate when ECMAScript 6 is released ;-)