aherbert commented on code in PR #359:
URL: https://github.com/apache/commons-math/pull/359#discussion_r4679557871


##########
commons-math-legacy-core/src/test/java/org/apache/commons/math4/legacy/core/dfp/DfpTest.java:
##########
@@ -116,6 +116,24 @@ public void testLongConstructor() {
         Assert.assertEquals("9223372036854775807.", new Dfp(field, 
Long.MAX_VALUE).toString());
     }
 
+    @Test
+    public void testLongConstructorBeyondPrecision() {
+        // 4 radix digits (16 decimal digits) cannot hold every long
+        final DfpField small = new DfpField(10);

Review Comment:
   The source code shows decimal digits < 13 using 4 radix digits 
(radix=10000). So we have configured for 16 decimal digits. But the long value 
`12345678901234567L` has 17 digits and is reproduced as exactly the same 
String, yet `1234567890123456789L` has 19 digits and is reproduced as a 15 
digit String plus exponent. So has rounding missed a digit? Should the result 
be "1.234567890123457e18"?
   
   This should show behaviour with 16, 17, 18 and 19 digit strings that expect 
rounding up or down when the Dfp has to round.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to