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

The following examples show how to use sun.misc.FloatingDecimal#appendTo() . 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 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 2
Source File: TestFloatingDecimal.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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 3
Source File: TestFloatingDecimal.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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 4
Source File: TestFloatingDecimal.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 5
Source File: TestFloatingDecimal.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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 6
Source File: TestFloatingDecimal.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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 TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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 8
Source File: TestFloatingDecimal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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 9
Source File: TestFloatingDecimal.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 10
Source File: TestFloatingDecimal.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 12
Source File: TestFloatingDecimal.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 13
Source File: AbstractStringBuilder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code double}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(double)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   d   a {@code double}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(double d) {
    FloatingDecimal.appendTo(d,this);
    return this;
}
 
Example 14
Source File: AbstractStringBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code double}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(double)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   d   a {@code double}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(double d) {
    FloatingDecimal.appendTo(d,this);
    return this;
}
 
Example 15
Source File: AbstractStringBuilder.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code double}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(double)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   d   a {@code double}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(double d) {
    FloatingDecimal.appendTo(d,this);
    return this;
}
 
Example 16
Source File: AbstractStringBuilder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code double}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(double)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   d   a {@code double}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(double d) {
    FloatingDecimal.appendTo(d,this);
    return this;
}
 
Example 17
Source File: AbstractStringBuilder.java    From AndroidComponentPlugin with Apache License 2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code double}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(double)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   d   a {@code double}.
 * @return  a reference to this object.
 * @hide
 */
public AbstractStringBuilder append(double d) {
    FloatingDecimal.appendTo(d,this);
    return this;
}
 
Example 18
Source File: AbstractStringBuilder.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Appends the string representation of the {@code float}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(float)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   f   a {@code float}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(float f) {
    FloatingDecimal.appendTo(f,this);
    return this;
}
 
Example 19
Source File: AbstractStringBuilder.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code float}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(float)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   f   a {@code float}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(float f) {
    FloatingDecimal.appendTo(f,this);
    return this;
}
 
Example 20
Source File: AbstractStringBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Appends the string representation of the {@code double}
 * argument to this sequence.
 * <p>
 * The overall effect is exactly as if the argument were converted
 * to a string by the method {@link String#valueOf(double)},
 * and the characters of that string were then
 * {@link #append(String) appended} to this character sequence.
 *
 * @param   d   a {@code double}.
 * @return  a reference to this object.
 */
public AbstractStringBuilder append(double d) {
    FloatingDecimal.appendTo(d,this);
    return this;
}