sun.misc.FloatingDecimal Java Examples
The following examples show how to use
sun.misc.FloatingDecimal.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestFloatingDecimal.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatRandom() { System.out.println(" testToJavaFormatStringFloatRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); failures += check("testToJavaFormatStringFloatRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[j])); } } return failures; }
Example #2
Source File: TestFloatingDecimal.java From hottub with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatRandom() { System.out.println(" testToJavaFormatStringFloatRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); failures += check("testToJavaFormatStringFloatRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[j])); } } return failures; }
Example #3
Source File: TestFloatingDecimal.java From hottub with GNU General Public License v2.0 | 6 votes |
private static int testParseFloat() { System.out.println(" testParseFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); float oldFloat = ofd.floatValue(); float newFloat = FloatingDecimal.parseFloat(javaFormatString); failures += check("testParseFloat", oldFloat, newFloat); } } return failures; }
Example #4
Source File: TestFloatingDecimal.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleRandom() { System.out.println(" testToJavaFormatStringDoubleRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); failures += check("testToJavaFormatStringDoubleRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[j])); } } return failures; }
Example #5
Source File: TestFloatingDecimal.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static int testAppendToFloat() { System.out.println(" testAppendToFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextLong(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(f[j], sb); String newString = sb.toString(); failures += check("testAppendToFloat", oldString, newString); } } return failures; }
Example #6
Source File: TestFloatingDecimal.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static int testAppendToFloat() { System.out.println(" testAppendToFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextLong(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(f[j], sb); String newString = sb.toString(); failures += check("testAppendToFloat", oldString, newString); } } return failures; }
Example #7
Source File: TestFloatingDecimal.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleFixed() { System.out.println(" testToJavaFormatStringDoubleFixed"); int failures = 0; double[] d = new double [] { -5.9522650387500933e18, // dtoa() fast path 0.872989018674569, // dtoa() fast iterative - long 1.1317400099603851e308 // dtoa() slow iterative }; for(int i = 0; i < d.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[i]); failures += check("testToJavaFormatStringDoubleFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[i])); } return failures; }
Example #8
Source File: TestFloatingDecimal.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleRandom() { System.out.println(" testToJavaFormatStringDoubleRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); failures += check("testToJavaFormatStringDoubleRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[j])); } } return failures; }
Example #9
Source File: TestFloatingDecimal.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatFixed() { System.out.println(" testToJavaFormatStringFloatFixed"); int failures = 0; float[] f = new float[] { -9.8784166e8f, // dtoa() fast path 0.70443946f, // dtoa() fast iterative - int 1.8254228e37f // dtoa() slow iterative }; for(int i = 0; i < f.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[i]); failures += check("testToJavaFormatStringFloatFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[i])); } return failures; }
Example #10
Source File: TestFloatingDecimal.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int testAppendToFloat() { System.out.println(" testAppendToFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextLong(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(f[j], sb); String newString = sb.toString(); failures += check("testAppendToFloat", oldString, newString); } } return failures; }
Example #11
Source File: TestFloatingDecimal.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static int testParseFloat() { System.out.println(" testParseFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); float oldFloat = ofd.floatValue(); float newFloat = FloatingDecimal.parseFloat(javaFormatString); failures += check("testParseFloat", oldFloat, newFloat); } } return failures; }
Example #12
Source File: TestFloatingDecimal.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleFixed() { System.out.println(" testToJavaFormatStringDoubleFixed"); int failures = 0; double[] d = new double [] { -5.9522650387500933e18, // dtoa() fast path 0.872989018674569, // dtoa() fast iterative - long 1.1317400099603851e308 // dtoa() slow iterative }; for(int i = 0; i < d.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[i]); failures += check("testToJavaFormatStringDoubleFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[i])); } return failures; }
Example #13
Source File: TestFloatingDecimal.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static int testAppendToFloat() { System.out.println(" testAppendToFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextLong(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(f[j], sb); String newString = sb.toString(); failures += check("testAppendToFloat", oldString, newString); } } return failures; }
Example #14
Source File: TestFloatingDecimal.java From hottub with GNU General Public License v2.0 | 6 votes |
private static int testAppendToDouble() { System.out.println(" testAppendToDouble"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(d[j], sb); String newString = sb.toString(); failures += check("testAppendToDouble", oldString, newString); } } return failures; }
Example #15
Source File: TestFloatingDecimal.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static int testParseDouble() { System.out.println(" testParseDouble"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); double oldDouble = ofd.doubleValue(); double newDouble = FloatingDecimal.parseDouble(javaFormatString); failures += check("testParseDouble", oldDouble, newDouble); } } return failures; }
Example #16
Source File: TestFloatingDecimal.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleRandom() { System.out.println(" testToJavaFormatStringDoubleRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); failures += check("testToJavaFormatStringDoubleRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[j])); } } return failures; }
Example #17
Source File: TestFloatingDecimal.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatFixed() { System.out.println(" testToJavaFormatStringFloatFixed"); int failures = 0; float[] f = new float[] { -9.8784166e8f, // dtoa() fast path 0.70443946f, // dtoa() fast iterative - int 1.8254228e37f // dtoa() slow iterative }; for(int i = 0; i < f.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[i]); failures += check("testToJavaFormatStringFloatFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[i])); } return failures; }
Example #18
Source File: TestFloatingDecimal.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatFixed() { System.out.println(" testToJavaFormatStringFloatFixed"); int failures = 0; float[] f = new float[] { -9.8784166e8f, // dtoa() fast path 0.70443946f, // dtoa() fast iterative - int 1.8254228e37f // dtoa() slow iterative }; for(int i = 0; i < f.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[i]); failures += check("testToJavaFormatStringFloatFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[i])); } return failures; }
Example #19
Source File: TestFloatingDecimal.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatRandom() { System.out.println(" testToJavaFormatStringFloatRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); failures += check("testToJavaFormatStringFloatRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[j])); } } return failures; }
Example #20
Source File: TestFloatingDecimal.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatRandom() { System.out.println(" testToJavaFormatStringFloatRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); failures += check("testToJavaFormatStringFloatRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[j])); } } return failures; }
Example #21
Source File: TestFloatingDecimal.java From hottub with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleRandom() { System.out.println(" testToJavaFormatStringDoubleRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); failures += check("testToJavaFormatStringDoubleRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[j])); } } return failures; }
Example #22
Source File: TestFloatingDecimal.java From hottub with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleFixed() { System.out.println(" testToJavaFormatStringDoubleFixed"); int failures = 0; double[] d = new double [] { -5.9522650387500933e18, // dtoa() fast path 0.872989018674569, // dtoa() fast iterative - long 1.1317400099603851e308 // dtoa() slow iterative }; for(int i = 0; i < d.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[i]); failures += check("testToJavaFormatStringDoubleFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[i])); } return failures; }
Example #23
Source File: TestFloatingDecimal.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringDoubleFixed() { System.out.println(" testToJavaFormatStringDoubleFixed"); int failures = 0; double[] d = new double [] { -5.9522650387500933e18, // dtoa() fast path 0.872989018674569, // dtoa() fast iterative - long 1.1317400099603851e308 // dtoa() slow iterative }; for(int i = 0; i < d.length; i++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[i]); failures += check("testToJavaFormatStringDoubleFixed", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(d[i])); } return failures; }
Example #24
Source File: TestFloatingDecimal.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static int testAppendToDouble() { System.out.println(" testAppendToDouble"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(d[j], sb); String newString = sb.toString(); failures += check("testAppendToDouble", oldString, newString); } } return failures; }
Example #25
Source File: TestFloatingDecimal.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static int testAppendToFloat() { System.out.println(" testAppendToFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextLong(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); StringBuilder sb = new StringBuilder(); ofd.appendTo(sb); String oldString = sb.toString(); sb = new StringBuilder(); FloatingDecimal.appendTo(f[j], sb); String newString = sb.toString(); failures += check("testAppendToFloat", oldString, newString); } } return failures; }
Example #26
Source File: TestFloatingDecimal.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static int testParseDouble() { System.out.println(" testParseDouble"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); double oldDouble = ofd.doubleValue(); double newDouble = FloatingDecimal.parseDouble(javaFormatString); failures += check("testParseDouble", oldDouble, newDouble); } } return failures; }
Example #27
Source File: TestFloatingDecimal.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int testParseFloat() { System.out.println(" testParseFloat"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); float oldFloat = ofd.floatValue(); float newFloat = FloatingDecimal.parseFloat(javaFormatString); failures += check("testParseFloat", oldFloat, newFloat); } } return failures; }
Example #28
Source File: TestFloatingDecimal.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static int testParseDouble() { System.out.println(" testParseDouble"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); double oldDouble = ofd.doubleValue(); double newDouble = FloatingDecimal.parseDouble(javaFormatString); failures += check("testParseDouble", oldDouble, newDouble); } } return failures; }
Example #29
Source File: TestFloatingDecimal.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static int testParseDouble() { System.out.println(" testParseDouble"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { double[] d = new double[] { RANDOM.nextLong(), RANDOM.nextGaussian(), RANDOM.nextDouble()*Double.MAX_VALUE }; for(int j = 0; j < d.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(d[j]); String javaFormatString = ofd.toJavaFormatString(); ofd = OldFloatingDecimalForTest.readJavaFormatString(javaFormatString); double oldDouble = ofd.doubleValue(); double newDouble = FloatingDecimal.parseDouble(javaFormatString); failures += check("testParseDouble", oldDouble, newDouble); } } return failures; }
Example #30
Source File: TestFloatingDecimal.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static int testToJavaFormatStringFloatRandom() { System.out.println(" testToJavaFormatStringFloatRandom"); int failures = 0; for(int i = 0; i < NUM_RANDOM_TESTS; i++) { float[] f = new float[] { RANDOM.nextInt(), (float)RANDOM.nextGaussian(), RANDOM.nextFloat()*Float.MAX_VALUE }; for(int j = 0; j < f.length; j++) { OldFloatingDecimalForTest ofd = new OldFloatingDecimalForTest(f[j]); failures += check("testToJavaFormatStringFloatRandom", ofd.toJavaFormatString(), FloatingDecimal.toJavaFormatString(f[j])); } } return failures; }