jdk/test/java/lang/Float/ParseFloat.java
author lana
Thu, 26 Dec 2013 12:04:16 -0800
changeset 23010 6dadb192ad81
parent 18537 2ae90e54f001
permissions -rw-r--r--
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013 Summary: updated files with 2011, 2012 and 2013 years according to the file's last updated date Reviewed-by: tbell, lancea, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 18537
diff changeset
     2
 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     4
 *
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     7
 * published by the Free Software Foundation.
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     8
 *
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    13
 * accompanied this code).
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    14
 *
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1826
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1826
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1826
diff changeset
    21
 * questions.
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    22
 */
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    23
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    24
/*
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    25
 * @test
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    26
 * @bug 4160406 4705734 4707389 6358355 7032154
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    27
 * @summary Tests for Float.parseFloat method
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    28
 */
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    29
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    30
import java.math.BigDecimal;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    31
import java.math.BigInteger;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    32
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    33
public class ParseFloat {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
    34
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    35
    private static final BigDecimal HALF = BigDecimal.valueOf(0.5);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    36
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    37
    private static void fail(String val, float n) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    38
        throw new RuntimeException("Float.parseFloat failed. String:" +
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    39
                                                val + " Result:" + n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    40
    }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    41
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    42
    private static void check(String val) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    43
        float n = Float.parseFloat(val);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    44
        boolean isNegativeN = n < 0 || n == 0 && 1/n < 0;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    45
        float na = Math.abs(n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    46
        String s = val.trim().toLowerCase();
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    47
        switch (s.charAt(s.length() - 1)) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    48
            case 'd':
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    49
            case 'f':
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    50
                s = s.substring(0, s.length() - 1);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    51
                break;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    52
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    53
        boolean isNegative = false;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    54
        if (s.charAt(0) == '+') {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    55
            s = s.substring(1);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    56
        } else if (s.charAt(0) == '-') {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    57
            s = s.substring(1);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    58
            isNegative = true;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    59
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    60
        if (s.equals("nan")) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    61
            if (!Float.isNaN(n)) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    62
                fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    63
            }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    64
            return;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    65
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    66
        if (Float.isNaN(n)) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    67
            fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    68
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    69
        if (isNegativeN != isNegative)
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    70
            fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    71
        if (s.equals("infinity")) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    72
            if (na != Float.POSITIVE_INFINITY) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    73
                fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    74
            }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    75
            return;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    76
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    77
        BigDecimal bd;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    78
        if (s.startsWith("0x")) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    79
            s = s.substring(2);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    80
            int indP = s.indexOf('p');
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    81
            long exp = Long.parseLong(s.substring(indP + 1));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    82
            int indD = s.indexOf('.');
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    83
            String significand;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    84
            if (indD >= 0) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    85
                significand = s.substring(0, indD) + s.substring(indD + 1, indP);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    86
                exp -= 4*(indP - indD - 1);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    87
            } else {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    88
                significand = s.substring(0, indP);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    89
            }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    90
            bd = new BigDecimal(new BigInteger(significand, 16));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    91
            if (exp >= 0) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    92
                bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    93
            } else {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    94
                bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    95
            }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    96
        } else {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    97
            bd = new BigDecimal(s);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    98
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
    99
        BigDecimal l, u;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   100
        if (Float.isInfinite(na)) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   101
            l = new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(Math.ulp(Float.MAX_VALUE)).multiply(HALF));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   102
            u = null;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   103
        } else {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   104
            l = new BigDecimal(na).subtract(new BigDecimal(Math.ulp(-Math.nextUp(-na))).multiply(HALF));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   105
            u = new BigDecimal(na).add(new BigDecimal(Math.ulp(n)).multiply(HALF));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   106
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   107
        int cmpL = bd.compareTo(l);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   108
        int cmpU = u != null ? bd.compareTo(u) : -1;
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   109
        if ((Float.floatToIntBits(n) & 1) != 0) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   110
            if (cmpL <= 0 || cmpU >= 0) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   111
                fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   112
            }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   113
        } else {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   114
            if (cmpL < 0 || cmpU > 0) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   115
                fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   116
            }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   117
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   118
    }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   119
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   120
    private static void check(String val, float expected) {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   121
        float n = Float.parseFloat(val);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   122
        if (n != expected)
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   123
            fail(val, n);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   124
        check(val);
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   125
    }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   126
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   127
    private static void rudimentaryTest() {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   128
        check(new String(""+Float.MIN_VALUE), Float.MIN_VALUE);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   129
        check(new String(""+Float.MAX_VALUE), Float.MAX_VALUE);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   130
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   131
        check("10",     (float)  10.0);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   132
        check("10.0",   (float)  10.0);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   133
        check("10.01",  (float)  10.01);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   134
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   135
        check("-10",    (float) -10.0);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   136
        check("-10.00", (float) -10.0);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   137
        check("-10.01", (float) -10.01);
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   138
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   139
        // bug 6358355
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   140
        check("144115196665790480", 0x1.000002p57f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   141
        check("144115196665790481", 0x1.000002p57f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   142
        check("0.050000002607703203", 0.05f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   143
        check("0.050000002607703204", 0.05f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   144
        check("0.050000002607703205", 0.05f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   145
        check("0.050000002607703206", 0.05f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   146
        check("0.050000002607703207", 0.05f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   147
        check("0.050000002607703208", 0.05f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   148
        check("0.050000002607703209", 0.050000004f);
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   149
    }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   150
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   151
    static  String badStrings[] = {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   152
        "",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   153
        "+",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   154
        "-",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   155
        "+e",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   156
        "-e",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   157
        "+e170",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   158
        "-e170",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   159
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   160
        // Make sure intermediate white space is not deleted.
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   161
        "1234   e10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   162
        "-1234   e10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   163
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   164
        // Control characters in the interior of a string are not legal
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   165
        "1\u0007e1",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   166
        "1e\u00071",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   167
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   168
        // NaN and infinity can't have trailing type suffices or exponents
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   169
        "NaNf",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   170
        "NaNF",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   171
        "NaNd",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   172
        "NaND",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   173
        "-NaNf",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   174
        "-NaNF",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   175
        "-NaNd",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   176
        "-NaND",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   177
        "+NaNf",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   178
        "+NaNF",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   179
        "+NaNd",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   180
        "+NaND",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   181
        "Infinityf",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   182
        "InfinityF",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   183
        "Infinityd",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   184
        "InfinityD",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   185
        "-Infinityf",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   186
        "-InfinityF",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   187
        "-Infinityd",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   188
        "-InfinityD",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   189
        "+Infinityf",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   190
        "+InfinityF",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   191
        "+Infinityd",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   192
        "+InfinityD",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   193
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   194
        "NaNe10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   195
        "-NaNe10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   196
        "+NaNe10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   197
        "Infinitye10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   198
        "-Infinitye10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   199
        "+Infinitye10",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   200
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   201
        // Non-ASCII digits are not recognized
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   202
        "\u0661e\u0661", // 1e1 in Arabic-Indic digits
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   203
        "\u06F1e\u06F1", // 1e1 in Extended Arabic-Indic digits
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   204
        "\u0967e\u0967" // 1e1 in Devanagari digits
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   205
    };
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   206
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   207
    static String goodStrings[] = {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   208
        "NaN",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   209
        "+NaN",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   210
        "-NaN",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   211
        "Infinity",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   212
        "+Infinity",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   213
        "-Infinity",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   214
        "1.1e-23f",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   215
        ".1e-23f",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   216
        "1e-23",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   217
        "1f",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   218
        "1",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   219
        "2",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   220
        "1234",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   221
        "-1234",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   222
        "+1234",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   223
        "2147483647",   // Integer.MAX_VALUE
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   224
        "2147483648",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   225
        "-2147483648",  // Integer.MIN_VALUE
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   226
        "-2147483649",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   227
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   228
        "16777215",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   229
        "16777216",     // 2^24
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   230
        "16777217",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   231
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   232
        "-16777215",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   233
        "-16777216",    // -2^24
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   234
        "-16777217",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   235
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   236
        "9007199254740991",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   237
        "9007199254740992",     // 2^53
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   238
        "9007199254740993",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   239
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   240
        "-9007199254740991",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   241
        "-9007199254740992",    // -2^53
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   242
        "-9007199254740993",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   243
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   244
        "9223372036854775807",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   245
        "9223372036854775808",  // Long.MAX_VALUE
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   246
        "9223372036854775809",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   247
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   248
        "-9223372036854775808",
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   249
        "-9223372036854775809", // Long.MIN_VALUE
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   250
        "-9223372036854775810"
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   251
    };
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   252
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   253
    static String paddedBadStrings[];
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   254
    static String paddedGoodStrings[];
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   255
    static {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   256
        String pad = " \t\n\r\f\u0001\u000b\u001f";
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   257
        paddedBadStrings = new String[badStrings.length];
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   258
        for(int i = 0 ; i <  badStrings.length; i++)
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   259
            paddedBadStrings[i] = pad + badStrings[i] + pad;
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   260
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   261
        paddedGoodStrings = new String[goodStrings.length];
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   262
        for(int i = 0 ; i <  goodStrings.length; i++)
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   263
            paddedGoodStrings[i] = pad + goodStrings[i] + pad;
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   264
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   265
    }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   266
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   267
    /*
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   268
     * Throws an exception if <code>Input</code> is
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   269
     * <code>exceptionalInput</code> and {@link Float.parseFloat
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   270
     * parseFloat} does <em>not</em> throw an exception or if
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   271
     * <code>Input</code> is not <code>exceptionalInput</code> and
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   272
     * <code>parseFloat</code> throws an exception.  This method does
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   273
     * not attempt to test whether the string is converted to the
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   274
     * proper value; just whether the input is accepted appropriately
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   275
     * or not.
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   276
     */
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   277
    private static void testParsing(String [] input,
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   278
                                    boolean exceptionalInput) {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   279
        for(int i = 0; i < input.length; i++) {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   280
            double d;
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   281
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   282
            try {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   283
                d = Float.parseFloat(input[i]);
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   284
                check(input[i]);
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   285
            }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   286
            catch (NumberFormatException e) {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   287
                if (! exceptionalInput) {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   288
                    throw new RuntimeException("Float.parseFloat rejected " +
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   289
                                               "good string `" + input[i] +
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   290
                                               "'.");
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   291
                }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   292
                break;
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   293
            }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   294
            if (exceptionalInput) {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   295
                throw new RuntimeException("Float.parseFloat accepted " +
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   296
                                           "bad string `" + input[i] +
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   297
                                           "'.");
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   298
            }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   299
        }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   300
    }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   301
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   302
    /**
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   303
     * For each power of two, test at boundaries of
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   304
     * region that should convert to that value.
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   305
     */
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   306
    private static void testPowers() {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   307
        for(int i = -149; i <= +127; i++) {
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   308
            float f = Math.scalb(1.0f, i);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   309
            BigDecimal f_BD = new BigDecimal(f);
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   310
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   311
            BigDecimal lowerBound = f_BD.subtract(new BigDecimal(Math.ulp(-Math.nextUp(-f))).multiply(HALF));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   312
            BigDecimal upperBound = f_BD.add(new BigDecimal(Math.ulp(f)).multiply(HALF));
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   313
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   314
            check(lowerBound.toString());
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   315
            check(upperBound.toString());
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   316
        }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   317
        check(new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(Math.ulp(Float.MAX_VALUE)).multiply(HALF)).toString());
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   318
    }
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   319
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   320
    public static void main(String[] args) throws Exception {
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   321
        rudimentaryTest();
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   322
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   323
        testParsing(goodStrings, false);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   324
        testParsing(paddedGoodStrings, false);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   325
        testParsing(badStrings, true);
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   326
        testParsing(paddedBadStrings, true);
18537
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   327
2ae90e54f001 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
bpb
parents: 5506
diff changeset
   328
        testPowers();
1826
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   329
    }
39d505a353e8 6601457: Move wrapper class tests from closed to open
darcy
parents:
diff changeset
   330
}