additional Math function

David Herman dherman at
Fri Nov 2 12:21:48 PDT 2012

On Nov 2, 2012, at 12:05 PM, Yehuda Katz <wycats at> wrote:

> Seems like a small surface-area with a large impact on compilers.
> At first glance, looks good to me.
> Curiosity: Does this overlap with Brendan's work on value objects (i.e. will it become moot in the face of them)

It could become unnecessary if you're working with value objects. If you had ordinary numbers, you'd have to coerce them to u32 and then multiply:

    var a = 0x7fffffff, b = 0x7fefefef; // both doubles
    var result = int32(a) * int32(b);   // int32
But value objects are still uncertain and at the very least much farther off into the future -- post-ES6. Engines could implement and ship Math.imul in very short order.


More information about the es-discuss mailing list