Java Code Examples for java.math.BigInteger#floatValue()

The following examples show how to use java.math.BigInteger#floatValue() . 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: FloatScalar.java    From smallrye-graphql with Apache License 2.0 6 votes vote down vote up
public FloatScalar() {

        super(Scalars.GraphQLFloat.getName(),
                new Converter() {
                    @Override
                    public Object fromBigDecimal(BigDecimal bigDecimal) {
                        return bigDecimal.floatValue();
                    }

                    @Override
                    public Object fromBigInteger(BigInteger bigInteger) {
                        return bigInteger.floatValue();
                    }

                },
                Float.class, float.class, Double.class, double.class);
    }
 
Example 2
Source File: PrimitiveConversionTests.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: PrimitiveConversionTests.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: PrimitiveConversionTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: PrimitiveConversionTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: PrimitiveConversionTests.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: PrimitiveConversionTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: PrimitiveConversionTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 9
Source File: PrimitiveConversionTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: PrimitiveConversionTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: PrimitiveConversionTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 12
Source File: PrimitiveConversionTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 13
Source File: PrimitiveConversionTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 14
Source File: PrimitiveConversionTests.java    From native-obfuscator with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 15
Source File: PrimitiveConversionTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 16
Source File: LargeIntegerExtensions.java    From gravel with Apache License 2.0 4 votes vote down vote up
public static float asFloat(BigInteger receiver) {
	return receiver.floatValue();
}
 
Example 17
Source File: FloatExtensions.java    From gravel with Apache License 2.0 4 votes vote down vote up
public static float differenceFromLargeInteger_(float receiver,
		BigInteger argument) {
	return argument.floatValue() - receiver;
}
 
Example 18
Source File: FloatExtensions.java    From gravel with Apache License 2.0 4 votes vote down vote up
public static float productFromLargeInteger_(float receiver,
		BigInteger argument) {
	return argument.floatValue() * receiver;
}
 
Example 19
Source File: FloatExtensions.java    From gravel with Apache License 2.0 4 votes vote down vote up
public static float quotientFromLargeInteger_(float receiver,
		BigInteger argument) {
	return argument.floatValue() / receiver;
}
 
Example 20
Source File: FloatExtensions.java    From gravel with Apache License 2.0 4 votes vote down vote up
public static float sumFromLargeInteger_(float receiver, BigInteger argument) {
	return argument.floatValue() + receiver;
}