[ 
https://issues.apache.org/jira/browse/JEXL-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13806334#comment-13806334
 ] 

Julien Aymé commented on JEXL-143:
----------------------------------

I think that the way the expression is written (2^62), it is evaluated to a 
double and then cast into long, which results to the rounding observed.

Could you try with the following expression instead : 1L << 62, it should be 
allright (wild guess here, cannot try it atm).

Regards,
Julien

> Huge numbers are rounded 
> -------------------------
>
>                 Key: JEXL-143
>                 URL: https://issues.apache.org/jira/browse/JEXL-143
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>         Environment: Ubunu 12.04, android studio 0.2.10
>            Reporter: Frank
>
> When calculating huge numbers, which are still in the long range the result 
> is wrong (or getting rounded somehow), e.g.
> Expression e = jexl.createExpression("2^62");
> JexlContext context = new MapContext();
> String res = String.valueOf(e.evaluate(context));
> returns `4611686018427388000` but it should be `4611686018427387904`



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to