Missing Math functions

Alistair Braidwood alistair_braidwood at yahoo.co.uk
Sat Mar 14 04:06:42 PDT 2009

The Math functions in ECMAScript are very much like the ones in Java 1 (deliberately so).

For some reason (reduced API size?) Sun decided to drop some standard C functions when they developed Java.  They have since reinstated some of them (since Java1.5)
In the current draft, section 15.8.2 says:

    "...The general intent is that an implementer should be able to use the same mathematical library for ECMAScript on a given hardware platform that is available to C programmers on that platform..."

I wondered if a future ECMAScript could expand its Math API to include functions such as log10, log2, and hypot?  I realize that these are calculable, but they occur often enough to be useful.

I'm not so sure about the browser-side uses of hyperbolic trig, but if it's easy to add, then why not - they are part of the standard pre-C99 math.h.


ps. this is not saying that ECMAScript should follow Java, more that as an independent language it can expand its math capabilities beyond the Java1 limit imposed at its creation.


More information about the Es-discuss mailing list