Java Code Examples for sun.misc.FloatingDecimal#parseDouble()

The following examples show how to use sun.misc.FloatingDecimal#parseDouble() . 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 dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 2
Source File: TestFloatingDecimal.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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 3
Source File: TestFloatingDecimal.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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 4
Source File: TestFloatingDecimal.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 5
Source File: TestFloatingDecimal.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 6
Source File: TestFloatingDecimal.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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 7
Source File: TestFloatingDecimal.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 8
Source File: Double.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 9
Source File: Double.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 10
Source File: Double.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 11
Source File: Double.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 12
Source File: Double.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 13
Source File: Double.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 14
Source File: Double.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 15
Source File: Double.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 16
Source File: Double.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 17
Source File: Double.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 18
Source File: Double.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 19
Source File: Double.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}
 
Example 20
Source File: Double.java    From AndroidComponentPlugin with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a new {@code double} initialized to the value
 * represented by the specified {@code String}, as performed
 * by the {@code valueOf} method of class
 * {@code Double}.
 *
 * @param  s   the string to be parsed.
 * @return the {@code double} value represented by the string
 *         argument.
 * @throws NullPointerException  if the string is null
 * @throws NumberFormatException if the string does not contain
 *         a parsable {@code double}.
 * @see    java.lang.Double#valueOf(String)
 * @since 1.2
 */
public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.parseDouble(s);
}