Brendan Eich (2013-07-25T20:03:20.000Z)
Oliver Hunt wrote:
> On Jul 25, 2013, at 12:11 PM, Waldemar Horwat <waldemar at google.com 
> <mailto:waldemar at google.com>> wrote:
>> On Thu, Jul 25, 2013 at 12:00 PM, Brendan Eich<brendan at mozilla.com 
>> <mailto:brendan at mozilla.com>>wrote
>>
>>     Michael Haufe wrote:
>>
>>         In 2008 I first proposed the addition of an integer division
>>         operator to the language. At the time Brendan noted his
>>         regret for this oversight and desire for the operator as
>>         well. I am not seeing this operator available in the current
>>         draft. Can/will this be rectified?
>>
>>         a div b = (a - a % b) / b
>>
>>
>>     This turns out to be equivalent to
>>
>>      (a/b)|0
>>
>>
>>     which is how asm.js optimizes to avoid the FPU already.
>>
>>
>> It's not equivalent for values greater than 2^31. The | version wraps 
>> around; div would give the correct answer.
>
> I presume brendan meant
>
> ((a|0/b|0)|0)
>
> Which seems to be the asm.js way -- although that said, there 
> shouldn't be any requirement on a compile flag to tell us what we can 
> simply turn this into an idiv...

There's no need, right. My "asm.js optimizes" was about the type system 
at http://asmjs.org/ -- not about any JS change or VM flag or whatever.

And yes, to Waldemar's point, this is for int32.

Michael, were you looking for integer-domain double div? I suppose we 
were back in 2008. It's still missing.

/be
>
> --Oliver
>
>>
>>     Waldemar
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss
>
domenic at domenicdenicola.com (2013-07-26T20:54:15.509Z)
There's no need, right. My "asm.js optimizes" was about the type system 
at http://asmjs.org/ -- not about any JS change or VM flag or whatever.

And yes, to Waldemar's point, this is for int32.

Michael, were you looking for integer-domain double div? I suppose we 
were back in 2008. It's still missing.