You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henrib <hb...@gmail.com> on 2009/09/02 17:31:48 UTC

[JEXL] / operator behavior change

As part of JEXL-87 (which relates to JEXL-65), the / operator now does
integer divisions on integers (big or small); in other words, it behaves the
same way the other operators do.

This is the common behavior in several languages (Java, ECMAScript, C, C++)
and the workaround if you need decimal precision is 4 characters away: 'x /
y' becomes 'x*1.0 / y' 
Given the targeted (known) usages of JEXL, it seems preferable to behave as
commonly expected rather than introducing another operator dedicated to
integer division.

Any strong votes against this modification ?
-- 
View this message in context: http://www.nabble.com/-JEXL----operator-behavior-change-tp25259888p25259888.html
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] / operator behavior change

Posted by Rahul Akolkar <ra...@gmail.com>.
On Wed, Sep 2, 2009 at 12:08 PM, sebb<se...@gmail.com> wrote:
> On 02/09/2009, Henrib <hb...@gmail.com> wrote:
>>
>>  As part of JEXL-87 (which relates to JEXL-65), the / operator now does
>>  integer divisions on integers (big or small); in other words, it behaves the
>>  same way the other operators do.
>>
>>  This is the common behavior in several languages (Java, ECMAScript, C, C++)
>>  and the workaround if you need decimal precision is 4 characters away: 'x /
>>  y' becomes 'x*1.0 / y'
>>  Given the targeted (known) usages of JEXL, it seems preferable to behave as
>>  commonly expected rather than introducing another operator dedicated to
>>  integer division.
>
> Agreed, now that integers are no longer promoted to double, the "/"
> and "div" commands are fine for integer division.
>
>>  Any strong votes against this modification ?
>
> OK by me.
>
> So long as we document the changes to how numbers are promoted.
>
<snip/>

Sounds good, and yes, please document and make a notable mention in
RELEASE-NOTES.txt [1] etc. (would be good for all of us to get in the
habit of updating release notes as notable changes are made --
especially ones that alter behavior).

-Rahul

[1] http://svn.apache.org/repos/asf/commons/proper/jexl/branches/2.0/RELEASE-NOTES.txt

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] / operator behavior change

Posted by sebb <se...@gmail.com>.
On 02/09/2009, Henrib <hb...@gmail.com> wrote:
>
>  As part of JEXL-87 (which relates to JEXL-65), the / operator now does
>  integer divisions on integers (big or small); in other words, it behaves the
>  same way the other operators do.
>
>  This is the common behavior in several languages (Java, ECMAScript, C, C++)
>  and the workaround if you need decimal precision is 4 characters away: 'x /
>  y' becomes 'x*1.0 / y'
>  Given the targeted (known) usages of JEXL, it seems preferable to behave as
>  commonly expected rather than introducing another operator dedicated to
>  integer division.

Agreed, now that integers are no longer promoted to double, the "/"
and "div" commands are fine for integer division.

>  Any strong votes against this modification ?

OK by me.

So long as we document the changes to how numbers are promoted.

> --
>  View this message in context: http://www.nabble.com/-JEXL----operator-behavior-change-tp25259888p25259888.html
>  Sent from the Commons - Dev mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org