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

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