ASF Bugzilla – Attachment 26430 Details for
Bug 50500
EL evaluation of floating-point String value vs BigInteger loses precision
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
ELArithmetic test case
ELArithmetic_Test.patch (text/plain), 1.31 KB, created by
brian.weisleder
on 2010-12-20 21:13:55 UTC
(
hide
)
Description:
ELArithmetic test case
Filename:
MIME Type:
Creator:
brian.weisleder
Created:
2010-12-20 21:13:55 UTC
Size:
1.31 KB
patch
obsolete
>Index: test/org/apache/el/lang/TestELArithmetic.java >=================================================================== >--- test/org/apache/el/lang/TestELArithmetic.java (revision -1+:000000000000+) >+++ test/org/apache/el/lang/TestELArithmetic.java (revision -1+:000000000000+) >@@ -0,0 +1,31 @@ >+package org.apache.el.lang; >+ >+import junit.framework.TestCase; >+ >+import java.math.BigDecimal; >+import java.math.BigInteger; >+ >+public class TestELArithmetic extends TestCase { >+ private final String a = "1.1"; >+ private final BigInteger b = new BigInteger("1000000000000000000000"); >+ >+ public void testAdd() throws Exception { >+ assertEquals("1000000000000000000001.1", String.valueOf(ELArithmetic.add(a, b))); >+ } >+ >+ public void testSubtract() throws Exception { >+ assertEquals("-999999999999999999998.9", String.valueOf(ELArithmetic.subtract(a, b))); >+ } >+ >+ public void testMultiply() throws Exception { >+ assertEquals("1100000000000000000000.0", String.valueOf(ELArithmetic.multiply(a, b))); >+ } >+ >+ public void testDivide() throws Exception { >+ assertEquals("0.0", String.valueOf(ELArithmetic.divide(a, b))); >+ } >+ >+ public void testMod() throws Exception { >+ assertEquals("1.1", String.valueOf(ELArithmetic.mod(a, b))); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 50500
:
26429
| 26430