commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (JEXL-106) When divide two BigDecimal values in an expression it results in java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
Date Thu, 03 Feb 2011 17:01:28 GMT

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

Henri Biestro resolved JEXL-106.
--------------------------------

    Resolution: Fixed

Added a MathContext to JexlArithmetic to control big decimal operations. Default uses IEEE
754R Decimal128 format.

Committed revision 1066867.
jexl/trunk/pom.xml
jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
jexl/trunk/src/site/xdoc/changes.xml
jexl/trunk/src/test/java/org/apache/commons/jexl2/IssuesTest.java


> When divide two BigDecimal values in an expression it results in java.lang.ArithmeticException:
Non-terminating decimal expansion; no exact representable decimal result.
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JEXL-106
>                 URL: https://issues.apache.org/jira/browse/JEXL-106
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Tomcat 6, Spring, Tapestry , Oracle DB, JEXL
>            Reporter: Michal Sabol
>            Assignee: Henri Biestro
>             Fix For: 2.0.2
>
>
> When having an expression X=A / B where
> A = BigDecimal(1);
> B = BigDecimal(3);
> the resulting evaluation of expression for X causes :
> java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable
decimal result.
> 	at java.math.BigDecimal.divide(BigDecimal.java:1603)
> 	at cz.lbbw.fis.playground.TestMS.big(TestMS.java:44)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
> 	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message