[ 
https://issues.apache.org/jira/browse/JEXL-50?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb reopened JEXL-50:
----------------------


It's not clear from the comments what the behaviour of "div" is now supposed to 
be.

Is the documentation correct, i.e. should DIV be integer division?
[IMO that would be the most useful solution]

If so, then the current 2.0 branch does not behave correctly. Sample test code:

{code}
public void test50() throws Exception {
    JexlEngine jexl = new JexlEngine();
    JexlContext ctxt = JexlHelper.createContext();
    assertEquals("1.5",jexl.createExpression("3 / 
2").evaluate(ctxt).toString());
    assertEquals("1",jexl.createExpression("3 div 
2").evaluate(ctxt).toString()); // fails - returns 1.5
}

{code}

If the documentation is incorrect, then the current SVN docn needs updating.

> Div operator does not do integer division
> -----------------------------------------
>
>                 Key: JEXL-50
>                 URL: https://issues.apache.org/jira/browse/JEXL-50
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Sebb
>             Fix For: 2.0
>
>         Attachments: org.zip
>
>
> The "div" operator behaves the same as "/" - however it should do integer 
> division according to the web-site:
> http://commons.apache.org/jexl/reference/syntax.html#Operators

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to