From what  I am seeing below this come out to :

"2.3 multiplied by 325 divided by 100"          Or              "2.3 * 3.25"

And that does equal your result.

I think you should be multiplying by 0.023 instead of 2.3.

Jason Dorsey | Engineering Intern
1233 West Loop South
Houston, TX 77027 USA
jason.dor...@netiq.com 
www.attachmate.com  |  www.netiq.com

-----Original Message-----
From: Даниил [mailto:danil...@gmail.com] 
Sent: Monday, April 09, 2012 2:53 AM
To: user@commons.apache.org
Subject: [jexl]

I'm trying to evaluate the expression 2.3% of value and I got invalid 
result:

My code is follow:
        BigDecimal bd = new BigDecimal("325");

        JexlEngine jexl = new JexlEngine();

        String expr = "2.3*SO/100";
       
        JexlContext jc = new MapContext();
        jc.set("SO", bd);
       
        Object evaluate = jexl.createExpression(expr).evaluate(jc);
        System.out.println(evaluate);

produce the result: 7.474999999999999 which is incorrect.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to