commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Даниил <danil...@gmail.com>
Subject [jexl]
Date Mon, 09 Apr 2012 07:53:15 GMT
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-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message