Java Code Examples for sun.misc.FloatConsts#POSITIVE_INFINITY

The following examples show how to use sun.misc.FloatConsts#POSITIVE_INFINITY . 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: Math.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 2
Source File: FpUtils.java    From j2objc with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@code Float.MIN_VALUE}
 *
 * </ul>
 *
 * @param f  starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @author Joseph D. Darcy
 */
 public static float nextUp(float f) {
    if( isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 3
Source File: Math.java    From j2objc with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 4
Source File: Math.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 5
Source File: Math.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 6
Source File: Math.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 7
Source File: Math.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 8
Source File: Math.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 9
Source File: Math.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 10
Source File: Math.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 11
Source File: Math.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 12
Source File: FpUtils.java    From javaide with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to <code>f</code> in
 * the direction of positive infinity.  This method is
 * semantically equivalent to <code>nextAfter(f,
 * Double.POSITIVE_INFINITY)</code>; however, a <code>nextUp</code>
 * implementation may run faster than its equivalent
 * <code>nextAfter</code> call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * <code>Float.MIN_VALUE</code>
 *
 * </ul>
 *
 * @param f  starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @author Joseph D. Darcy
 */
 public static float nextUp(float f) {
    if( isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 13
Source File: Math.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 14
Source File: Math.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 15
Source File: FpUtils.java    From java-n-IDE-for-Android with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to <code>f</code> in
 * the direction of positive infinity.  This method is
 * semantically equivalent to <code>nextAfter(f,
 * Double.POSITIVE_INFINITY)</code>; however, a <code>nextUp</code>
 * implementation may run faster than its equivalent
 * <code>nextAfter</code> call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * <code>Float.MIN_VALUE</code>
 *
 * </ul>
 *
 * @param f  starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @author Joseph D. Darcy
 */
 public static float nextUp(float f) {
    if( isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 16
Source File: Math.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 17
Source File: Math.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 18
Source File: Math.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 19
Source File: Math.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}
 
Example 20
Source File: Math.java    From AndroidComponentPlugin with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the floating-point value adjacent to {@code f} in
 * the direction of positive infinity.  This method is
 * semantically equivalent to {@code nextAfter(f,
 * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
 * implementation may run faster than its equivalent
 * {@code nextAfter} call.
 *
 * <p>Special Cases:
 * <ul>
 * <li> If the argument is NaN, the result is NaN.
 *
 * <li> If the argument is positive infinity, the result is
 * positive infinity.
 *
 * <li> If the argument is zero, the result is
 * {@link Float#MIN_VALUE}
 *
 * </ul>
 *
 * @param f starting floating-point value
 * @return The adjacent floating-point value closer to positive
 * infinity.
 * @since 1.6
 */
public static float nextUp(float f) {
    if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
        return f;
    else {
        f += 0.0f;
        return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
                                    ((f >= 0.0f)?+1:-1));
    }
}