commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1366821 - in /commons/proper/math/trunk/src: changes/ main/java/org/apache/commons/math3/linear/ main/java/org/apache/commons/math3/util/ test/java/org/apache/commons/math3/complex/ test/java/org/apache/commons/math3/geometry/euclidean/thr...
Date Sun, 29 Jul 2012 12:05:49 GMT
Author: erans
Date: Sun Jul 29 12:05:48 2012
New Revision: 1366821

URL: http://svn.apache.org/viewvc?rev=1366821&view=rev
Log:
MATH-622
Default is now to print 10 fractional digits.

Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/CompositeFormat.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/complex/ComplexFormatAbstractTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealMatrixFormatAbstractTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorFormatAbstractTest.java

Modified: commons/proper/math/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Sun Jul 29 12:05:48 2012
@@ -52,6 +52,9 @@ If the output is not quite correct, chec
   <body>
     <release version="3.1" date="TBD" description="
 ">
+      <action dev="erans" type="fix" issue="MATH-622">
+        Raised (to 10) the default number of fractional digits to print out.
+      </action>
       <action dev="erans" type="fix" issue="MATH-762">
         Removed duplicate code.
       </action>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
Sun Jul 29 12:05:48 2012
@@ -89,8 +89,8 @@ public class LUDecomposition {
                                                matrix.getColumnDimension());
         }
 
-        final int m = matrix.getColumnDimension();
         lu = matrix.getData();
+        final int m = lu.length;
         pivot = new int[m];
         cachedL = null;
         cachedU = null;
@@ -105,15 +105,20 @@ public class LUDecomposition {
 
         // Loop over columns
         for (int col = 0; col < m; col++) {
+            final double[] luColumnCol = new double[m];
+            for (int i = 0; i < m; i++) {
+                luColumnCol[i] = lu[i][col];
+            }
 
             // upper
             for (int row = 0; row < col; row++) {
                 final double[] luRow = lu[row];
                 double sum = luRow[col];
                 for (int i = 0; i < row; i++) {
-                    sum -= luRow[i] * lu[i][col];
+                    sum -= luRow[i] * luColumnCol[i];
                 }
                 luRow[col] = sum;
+                luColumnCol[row] = sum;
             }
 
             // lower
@@ -123,9 +128,10 @@ public class LUDecomposition {
                 final double[] luRow = lu[row];
                 double sum = luRow[col];
                 for (int i = 0; i < col; i++) {
-                    sum -= luRow[i] * lu[i][col];
+                    sum -= luRow[i] * luColumnCol[i];
                 }
                 luRow[col] = sum;
+                luColumnCol[row] = sum;
 
                 // maintain best permutation choice
                 if (FastMath.abs(sum) > largest) {
@@ -135,22 +141,21 @@ public class LUDecomposition {
             }
 
             // Singularity check
-            if (FastMath.abs(lu[max][col]) < singularityThreshold) {
+            if (FastMath.abs(luColumnCol[max]) < singularityThreshold) {
                 singular = true;
                 return;
             }
 
             // Pivot if necessary
             if (max != col) {
-                double tmp = 0;
                 final double[] luMax = lu[max];
                 final double[] luCol = lu[col];
                 for (int i = 0; i < m; i++) {
-                    tmp = luMax[i];
+                    final double tmp = luMax[i];
                     luMax[i] = luCol[i];
                     luCol[i] = tmp;
                 }
-                int temp = pivot[max];
+                final int temp = pivot[max];
                 pivot[max] = pivot[col];
                 pivot[col] = temp;
                 even = !even;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/CompositeFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/CompositeFormat.java?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/CompositeFormat.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/CompositeFormat.java
Sun Jul 29 12:05:48 2012
@@ -52,7 +52,7 @@ public class CompositeFormat {
      */
     public static NumberFormat getDefaultNumberFormat(final Locale locale) {
         final NumberFormat nf = NumberFormat.getInstance(locale);
-        nf.setMaximumFractionDigits(2);
+        nf.setMaximumFractionDigits(10);
         return nf;
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/complex/ComplexFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/complex/ComplexFormatAbstractTest.java?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/complex/ComplexFormatAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/complex/ComplexFormatAbstractTest.java
Sun Jul 29 12:05:48 2012
@@ -84,48 +84,48 @@ public abstract class ComplexFormatAbstr
 
     @Test
     public void testSimpleWithDecimalsTrunc() {
-        Complex c = new Complex(1.2323, 1.4343);
-        String expected = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter()
+ "43i";
+        Complex c = new Complex(1.232323232323, 1.434343434343);
+        String expected = "1" + getDecimalCharacter() + "2323232323 + 1" + getDecimalCharacter()
+ "4343434343i";
         String actual = complexFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeReal() {
-        Complex c = new Complex(-1.2323, 1.4343);
-        String expected = "-1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter()
+ "43i";
+        Complex c = new Complex(-1.232323232323, 1.43);
+        String expected = "-1" + getDecimalCharacter() + "2323232323 + 1" + getDecimalCharacter()
+ "43i";
         String actual = complexFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeImaginary() {
-        Complex c = new Complex(1.2323, -1.4343);
-        String expected = "1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter()
+ "43i";
+        Complex c = new Complex(1.23, -1.434343434343);
+        String expected = "1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter()
+ "4343434343i";
         String actual = complexFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeBoth() {
-        Complex c = new Complex(-1.2323, -1.4343);
-        String expected = "-1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter()
+ "43i";
+        Complex c = new Complex(-1.232323232323, -1.434343434343);
+        String expected = "-1" + getDecimalCharacter() + "2323232323 - 1" + getDecimalCharacter()
+ "4343434343i";
         String actual = complexFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testZeroReal() {
-        Complex c = new Complex(0.0, -1.4343);
-        String expected = "0 - 1" + getDecimalCharacter() + "43i";
+        Complex c = new Complex(0.0, -1.434343434343);
+        String expected = "0 - 1" + getDecimalCharacter() + "4343434343i";
         String actual = complexFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testZeroImaginary() {
-        Complex c = new Complex(30.233, 0);
-        String expected = "30" + getDecimalCharacter() + "23";
+        Complex c = new Complex(30.23333333333, 0);
+        String expected = "30" + getDecimalCharacter() + "2333333333";
         String actual = complexFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
@@ -143,8 +143,8 @@ public abstract class ComplexFormatAbstr
         Locale defaultLocal = Locale.getDefault();
         Locale.setDefault(getLocale());
 
-        Complex c = new Complex(232.222, -342.33);
-        String expected = "232" + getDecimalCharacter() + "22 - 342" + getDecimalCharacter()
+ "33i";
+        Complex c = new Complex(232.22222222222, -342.3333333333);
+        String expected = "232" + getDecimalCharacter() + "2222222222 - 342" + getDecimalCharacter()
+ "3333333333i";
         String actual = (new ComplexFormat()).format(c);
         Assert.assertEquals(expected, actual);
 
@@ -193,32 +193,32 @@ public abstract class ComplexFormatAbstr
 
     @Test
     public void testParseSimpleWithDecimalsTrunc() {
-        String source = "1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter()
+ "4343i";
-        Complex expected = new Complex(1.2323, 1.4343);
+        String source = "1" + getDecimalCharacter() + "232323232323 + 1" + getDecimalCharacter()
+ "434343434343i";
+        Complex expected = new Complex(1.232323232323, 1.434343434343);
         Complex actual = complexFormat.parse(source);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testParseNegativeReal() {
-        String source = "-1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter()
+ "4343i";
-        Complex expected = new Complex(-1.2323, 1.4343);
+        String source = "-1" + getDecimalCharacter() + "232323232323 + 1" + getDecimalCharacter()
+ "4343i";
+        Complex expected = new Complex(-1.232323232323, 1.4343);
         Complex actual = complexFormat.parse(source);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testParseNegativeImaginary() {
-        String source = "1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter()
+ "4343i";
-        Complex expected = new Complex(1.2323, -1.4343);
+        String source = "1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter()
+ "434343434343i";
+        Complex expected = new Complex(1.2323, -1.434343434343);
         Complex actual = complexFormat.parse(source);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testParseNegativeBoth() {
-        String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter()
+ "4343i";
-        Complex expected = new Complex(-1.2323, -1.4343);
+        String source = "-1" + getDecimalCharacter() + "232323232323 - 1" + getDecimalCharacter()
+ "434343434343i";
+        Complex expected = new Complex(-1.232323232323, -1.434343434343);
         Complex actual = complexFormat.parse(source);
         Assert.assertEquals(expected, actual);
     }
@@ -298,7 +298,7 @@ public abstract class ComplexFormatAbstr
         ComplexFormat cf = ComplexFormat.getInstance(getLocale());
         Double pi = Double.valueOf(FastMath.PI);
         String text = cf.format(pi);
-        Assert.assertEquals("3" + getDecimalCharacter() + "14", text);
+        Assert.assertEquals("3" + getDecimalCharacter() + "1415926536", text);
     }
 
     @Test

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
Sun Jul 29 12:05:48 2012
@@ -64,22 +64,22 @@ public abstract class Vector3DFormatAbst
 
     @Test
     public void testSimpleWithDecimalsTrunc() {
-        Vector3D c = new Vector3D(1.2323, 1.4343, 1.6333);
+        Vector3D c = new Vector3D(1.232323232323, 1.434343434343, 1.633333333333);
         String expected =
             "{1"    + getDecimalCharacter() +
-            "23; 1" + getDecimalCharacter() +
-            "43; 1" + getDecimalCharacter() +
-            "63}";
+            "2323232323; 1" + getDecimalCharacter() +
+            "4343434343; 1" + getDecimalCharacter() +
+            "6333333333}";
         String actual = vector3DFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeX() {
-        Vector3D c = new Vector3D(-1.2323, 1.4343, 1.6333);
+        Vector3D c = new Vector3D(-1.232323232323, 1.43, 1.63);
         String expected =
             "{-1"    + getDecimalCharacter() +
-            "23; 1" + getDecimalCharacter() +
+            "2323232323; 1" + getDecimalCharacter() +
             "43; 1" + getDecimalCharacter() +
             "63}";
         String actual = vector3DFormat.format(c);
@@ -88,11 +88,11 @@ public abstract class Vector3DFormatAbst
 
     @Test
     public void testNegativeY() {
-        Vector3D c = new Vector3D(1.2323, -1.4343, 1.6333);
+        Vector3D c = new Vector3D(1.23, -1.434343434343, 1.63);
         String expected =
             "{1"    + getDecimalCharacter() +
             "23; -1" + getDecimalCharacter() +
-            "43; 1" + getDecimalCharacter() +
+            "4343434343; 1" + getDecimalCharacter() +
             "63}";
         String actual = vector3DFormat.format(c);
         Assert.assertEquals(expected, actual);
@@ -100,12 +100,12 @@ public abstract class Vector3DFormatAbst
 
     @Test
     public void testNegativeZ() {
-        Vector3D c = new Vector3D(1.2323, 1.4343, -1.6333);
+        Vector3D c = new Vector3D(1.23, 1.43, -1.633333333333);
         String expected =
             "{1"    + getDecimalCharacter() +
             "23; 1" + getDecimalCharacter() +
             "43; -1" + getDecimalCharacter() +
-            "63}";
+            "6333333333}";
         String actual = vector3DFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
@@ -123,12 +123,12 @@ public abstract class Vector3DFormatAbst
         Locale defaultLocal = Locale.getDefault();
         Locale.setDefault(getLocale());
 
-        Vector3D c = new Vector3D(232.222, -342.33, 432.444);
+        Vector3D c = new Vector3D(232.22222222222, -342.3333333333, 432.44444444444);
         String expected =
             "{232"    + getDecimalCharacter() +
-            "22; -342" + getDecimalCharacter() +
-            "33; 432" + getDecimalCharacter() +
-            "44}";
+            "2222222222; -342" + getDecimalCharacter() +
+            "3333333333; 432" + getDecimalCharacter() +
+            "4444444444}";
         String actual = (new Vector3DFormat()).format(c);
         Assert.assertEquals(expected, actual);
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealMatrixFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealMatrixFormatAbstractTest.java?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealMatrixFormatAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealMatrixFormatAbstractTest.java
Sun Jul 29 12:05:48 2012
@@ -68,64 +68,64 @@ public abstract class RealMatrixFormatAb
 
     @Test
     public void testSimpleWithDecimalsTrunc() {
-        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{1.2323, 1.4343, 1.6333},
-                                                                    {2.4666, 2.4666, 2.6666}});
+        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{1.232323232323, 1.43,
1.63},
+                                                                    {2.46, 2.46, 2.666666666666}});
         String expected =
                 "{{1"    + getDecimalCharacter() +
-                "23,1" + getDecimalCharacter() +
+                "2323232323,1" + getDecimalCharacter() +
                 "43,1" + getDecimalCharacter() +
                 "63},{2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "67}}";
+                "46,2" + getDecimalCharacter() +
+                "46,2" + getDecimalCharacter() +
+                "6666666667}}";
         String actual = realMatrixFormat.format(m);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeComponent() {
-        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{-1.2323, 1.4343, 1.6333},
-                                                                    {2.4666, 2.4666, 2.6666}});
+        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{-1.232323232323, 1.43,
1.63},
+                                                                    {2.46, 2.46, 2.66}});
         String expected =
                 "{{-1"    + getDecimalCharacter() +
-                "23,1" + getDecimalCharacter() +
+                "2323232323,1" + getDecimalCharacter() +
                 "43,1" + getDecimalCharacter() +
                 "63},{2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "67}}";
+                "46,2" + getDecimalCharacter() +
+                "46,2" + getDecimalCharacter() +
+                "66}}";
         String actual = realMatrixFormat.format(m);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeComponent2() {
-        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{1.2323, -1.4343, 1.6333},
-                                                                    {2.4666, 2.4666, 2.6666}});
+        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{1.23, -1.434343434343,
1.63},
+                                                                    {2.46, 2.46, 2.66}});
         String expected =
                 "{{1"    + getDecimalCharacter() +
                 "23,-1" + getDecimalCharacter() +
-                "43,1" + getDecimalCharacter() +
+                "4343434343,1" + getDecimalCharacter() +
                 "63},{2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "67}}";
+                "46,2" + getDecimalCharacter() +
+                "46,2" + getDecimalCharacter() +
+                "66}}";
         String actual = realMatrixFormat.format(m);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeSecondRow() {
-        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{1.2323, 1.4343, 1.6333},
-                                                                    {-2.4666, 2.4666, 2.6666}});
+        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{1.23, 1.43, 1.63},
+                                                                    {-2.66666666666, 2.46,
2.66}});
         String expected =
                 "{{1"    + getDecimalCharacter() +
                 "23,1" + getDecimalCharacter() +
                 "43,1" + getDecimalCharacter() +
                 "63},{-2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "47,2" + getDecimalCharacter() +
-                "67}}";
+                "6666666667,2" + getDecimalCharacter() +
+                "46,2" + getDecimalCharacter() +
+                "66}}";
         String actual = realMatrixFormat.format(m);
         Assert.assertEquals(expected, actual);
     }
@@ -143,12 +143,12 @@ public abstract class RealMatrixFormatAb
         Locale defaultLocale = Locale.getDefault();
         Locale.setDefault(getLocale());
 
-        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{232.222, -342.33, 432.444}});
+        RealMatrix m = MatrixUtils.createRealMatrix(new double[][] {{232.2222222222, -342.33333333333,
432.44444444444}});
         String expected =
             "{{232"    + getDecimalCharacter() +
-            "22,-342" + getDecimalCharacter() +
-            "33,432" + getDecimalCharacter() +
-            "44}}";
+            "2222222222,-342" + getDecimalCharacter() +
+            "3333333333,432" + getDecimalCharacter() +
+            "4444444444}}";
         String actual = (new RealMatrixFormat()).format(m);
         Assert.assertEquals(expected, actual);
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorFormatAbstractTest.java?rev=1366821&r1=1366820&r2=1366821&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorFormatAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorFormatAbstractTest.java
Sun Jul 29 12:05:48 2012
@@ -64,22 +64,22 @@ public abstract class RealVectorFormatAb
 
     @Test
     public void testSimpleWithDecimalsTrunc() {
-        ArrayRealVector c = new ArrayRealVector(new double[] {1.2323, 1.4343, 1.6333});
+        ArrayRealVector c = new ArrayRealVector(new double[] {1.232323232323, 1.43434343434343,
1.633333333333});
         String expected =
             "{1"    + getDecimalCharacter() +
-            "23; 1" + getDecimalCharacter() +
-            "43; 1" + getDecimalCharacter() +
-            "63}";
+            "2323232323; 1" + getDecimalCharacter() +
+            "4343434343; 1" + getDecimalCharacter() +
+            "6333333333}";
         String actual = realVectorFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testNegativeX() {
-        ArrayRealVector c = new ArrayRealVector(new double[] {-1.2323, 1.4343, 1.6333});
+        ArrayRealVector c = new ArrayRealVector(new double[] {-1.232323232323, 1.43, 1.63});
         String expected =
             "{-1"    + getDecimalCharacter() +
-            "23; 1" + getDecimalCharacter() +
+            "2323232323; 1" + getDecimalCharacter() +
             "43; 1" + getDecimalCharacter() +
             "63}";
         String actual = realVectorFormat.format(c);
@@ -88,11 +88,11 @@ public abstract class RealVectorFormatAb
 
     @Test
     public void testNegativeY() {
-        ArrayRealVector c = new ArrayRealVector(new double[] {1.2323, -1.4343, 1.6333});
+        ArrayRealVector c = new ArrayRealVector(new double[] {1.23, -1.434343434343, 1.63});
         String expected =
             "{1"    + getDecimalCharacter() +
             "23; -1" + getDecimalCharacter() +
-            "43; 1" + getDecimalCharacter() +
+            "4343434343; 1" + getDecimalCharacter() +
             "63}";
         String actual = realVectorFormat.format(c);
         Assert.assertEquals(expected, actual);
@@ -100,12 +100,12 @@ public abstract class RealVectorFormatAb
 
     @Test
     public void testNegativeZ() {
-        ArrayRealVector c = new ArrayRealVector(new double[] {1.2323, 1.4343, -1.6333});
+        ArrayRealVector c = new ArrayRealVector(new double[] {1.23, 1.43, -1.633333333333});
         String expected =
             "{1"    + getDecimalCharacter() +
             "23; 1" + getDecimalCharacter() +
             "43; -1" + getDecimalCharacter() +
-            "63}";
+            "6333333333}";
         String actual = realVectorFormat.format(c);
         Assert.assertEquals(expected, actual);
     }
@@ -123,12 +123,12 @@ public abstract class RealVectorFormatAb
         Locale defaultLocal = Locale.getDefault();
         Locale.setDefault(getLocale());
 
-        ArrayRealVector c = new ArrayRealVector(new double[] {232.222, -342.33, 432.444});
+        ArrayRealVector c = new ArrayRealVector(new double[] {232.22222222222, -342.3333333333,
432.44444444444});
         String expected =
             "{232"    + getDecimalCharacter() +
-            "22; -342" + getDecimalCharacter() +
-            "33; 432" + getDecimalCharacter() +
-            "44}";
+            "2222222222; -342" + getDecimalCharacter() +
+            "3333333333; 432" + getDecimalCharacter() +
+            "4444444444}";
         String actual = (new RealVectorFormat()).format(c);
         Assert.assertEquals(expected, actual);
 



Mime
View raw message