< prev index next >

test/jdk/java/math/BigInteger/PrimitiveConversionTests.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 61,95 **** ALL_BIGINTEGER_CANDIDATES = Collections.unmodifiableList(samples); } public static int testDoubleValue() { int failures = 0; for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) { double expected = Double.parseDouble(big.toString()); double actual = big.doubleValue(); // should be bitwise identical if (Double.doubleToRawLongBits(expected) != Double .doubleToRawLongBits(actual)) { ! System.out.println(big); failures++; } } return failures; } public static int testFloatValue() { int failures = 0; for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) { float expected = Float.parseFloat(big.toString()); float actual = big.floatValue(); // should be bitwise identical if (Float.floatToRawIntBits(expected) != Float .floatToRawIntBits(actual)) { ! System.out.println(big + " " + expected + " " + actual); failures++; } } return failures; } --- 61,99 ---- ALL_BIGINTEGER_CANDIDATES = Collections.unmodifiableList(samples); } public static int testDoubleValue() { + System.out.println("--- testDoubleValue ---"); int failures = 0; for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) { double expected = Double.parseDouble(big.toString()); double actual = big.doubleValue(); // should be bitwise identical if (Double.doubleToRawLongBits(expected) != Double .doubleToRawLongBits(actual)) { ! System.out.format("big: %s, expected: %f, actual: %f%n", ! big, expected, actual); failures++; } } return failures; } public static int testFloatValue() { + System.out.println("--- testFloatValue ---"); int failures = 0; for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) { float expected = Float.parseFloat(big.toString()); float actual = big.floatValue(); // should be bitwise identical if (Float.floatToRawIntBits(expected) != Float .floatToRawIntBits(actual)) { ! System.out.format("big: %s, expected: %f, actual: %f%n", ! big, expected, actual); failures++; } } return failures; }
< prev index next >