additional Math function

Brendan Eich brendan at mozilla.com
Fri Apr 26 12:58:30 PDT 2013


We did talk about Math.imul, Dave presented it briefly IIRC last fall. 
It's a bite-sized win. Should be able to get it into ES6.

/be

Rick Waldron wrote:
> Filed https://bugs.ecmascript.org/show_bug.cgi?id=1452
>
>
> On Fri, Apr 26, 2013 at 2:01 PM, Oliver Hunt <oliver at apple.com 
> <mailto:oliver at apple.com>> wrote:
>
>     I landed support for Math.imul in JSC yesterday as well.
>
>     Can't find actual documentation on the expected behavior so just
>     copied what mozilla does.
>
>     --Oliver
>
>     On Apr 26, 2013, at 10:58 AM, Rick Waldron <waldron.rick at gmail.com
>     <mailto:waldron.rick at gmail.com>> wrote:
>
>>
>>     On Apr 26, 2013 8:42 AM, "Tom Schuster" <tom at schuster.me
>>     <mailto:tom at schuster.me>> wrote:
>>     >
>>     > Math.imul support was just added to the v8 trunk:
>>     > https://code.google.com/p/v8/source/detail?r=14450.
>>     > Is there any ongoing effort to standardize it?
>>     >
>>
>>     As with Firefox, which you actually implemented :)
>>
>>     https://bugzilla.mozilla.org/show_bug.cgi?id=808148
>>
>>     There is no record of consensus (that I can locate) since this
>>     thread first began. I don't see why anyone object, but we should
>>     get it on record.
>>
>>     Rick
>>
>>
>>
>>     > On Fri, Nov 2, 2012 at 9:24 PM, Brendan Eich
>>     <brendan at mozilla.org <mailto:brendan at mozilla.org>> wrote:
>>     > > David Herman wrote:
>>     > >>
>>     > >> On Nov 2, 2012, at 12:05 PM, Yehuda Katz<wycats at gmail.com
>>     <mailto:wycats at gmail.com>>  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
>>     > >
>>     > >
>>     > > I'm focusing on int64 and uint64 but making the framework as
>>     general under
>>     > > the hood as possible (e.g., the operators stuff, a
>>     multimethod variation
>>     > > that's inline-cacheable, based on an idea from Christian
>>     Plesner Hansen).
>>     > >
>>     > > The need for 64-bit ints is pretty strong in Node.js and I
>>     think this means
>>     > > value objects are a priority for ES7.
>>     > >
>>     > >
>>     > >>   and at the very least much farther off into the future --
>>     post-ES6.
>>     > >> Engines could implement and ship Math.imul in very short order.
>>     > >
>>     > >
>>     > > Agreed, and this kind of micro-evolution is important to
>>     support even while
>>     > > working on value objects for post-ES6. It may be we end up
>>     with int32 and
>>     > > uint32, but we don't need to if there's no strong use-case
>>     not satisfied by
>>     > > Math.imul.
>>     > >
>>     > > Note that there's no micro-evolutionary step involving
>>     Math.imul64 that
>>     > > satisfies the int64/uint64 use-cases Node faces (buffer and file
>>     > > sizes/offsets). You need 64-bit addition, subtraction, and
>>     probably other
>>     > > operators -- and you need the data type, not just operations
>>     that could be
>>     > > Math methods.
>>     > >
>>     > > /be
>>     > >
>>     > > _______________________________________________
>>     > > es-discuss mailing list
>>     > > es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>>     > > https://mail.mozilla.org/listinfo/es-discuss
>>     > _______________________________________________
>>     > es-discuss mailing list
>>     > es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>>     > https://mail.mozilla.org/listinfo/es-discuss
>>
>>     _______________________________________________
>>     es-discuss mailing list
>>     es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>>     https://mail.mozilla.org/listinfo/es-discuss
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list