/** * Returns the float value corresponding to the given * hexadecimal floating-point single precision literal. * The literal must be syntactically correct, and must be * a float literal (end in a 'f' or 'F'). It must not * include either leading or trailing whitespace or * a sign. * <p> * This method returns the same answer as * Float.parseFloat(new String(source)) does in JDK 1.5, * except that this method returns Floal.NaN if it * would underflow to 0 (parseFloat just returns 0). * The method handles all the tricky cases, including * fraction rounding to 24 bits and gradual underflow. * </p> * * @param source source string containing single precision * hexadecimal floating-point literal * @return the float value, including Float.POSITIVE_INFINITY * if the non-zero value is too large to be represented, and * Float.NaN if the non-zero value is too small to be represented */ public static float valueOfHexFloatLiteral(char[] source) { long bits = convertHexFloatingPointLiteralToBits(source); return Float.intBitsToFloat((int) bits); }
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {
/** * Returns the double value corresponding to the given * hexadecimal floating-point double precision literal. * The literal must be syntactially correct, and must be * a double literal (end in an optional 'd' or 'D'). * It must not include either leading or trailing whitespace or * a sign. * <p> * This method returns the same answer as * Double.parseDouble(new String(source)) does in JDK 1.5, * except that this method throw NumberFormatException in * the case of overflow to infinity or underflow to 0. * The method handles all the tricky cases, including * fraction rounding to 53 bits and gradual underflow. * </p> * * @param source source string containing double precision * hexadecimal floating-point literal * @return the double value, including Double.POSITIVE_INFINITY * if the non-zero value is too large to be represented, and * Double.NaN if the non-zero value is too small to be represented */ public static double valueOfHexDoubleLiteral(char[] source) { long bits = convertHexFloatingPointLiteralToBits(source); return Double.longBitsToDouble(bits); }
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {
/** * Returns the float value corresponding to the given * hexadecimal floating-point single precision literal. * The literal must be syntactially correct, and must be * a float literal (end in a 'f' or 'F'). It must not * include either leading or trailing whitespace or * a sign. * <p> * This method returns the same answer as * Float.parseFloat(new String(source)) does in JDK 1.5, * except that this method returns Floal.NaN if it * would underflow to 0 (parseFloat just returns 0). * The method handles all the tricky cases, including * fraction rounding to 24 bits and gradual underflow. * </p> * * @param source source string containing single precision * hexadecimal floating-point literal * @return the float value, including Float.POSITIVE_INFINITY * if the non-zero value is too large to be represented, and * Float.NaN if the non-zero value is too small to be represented */ public static float valueOfHexFloatLiteral(char[] source) { long bits = convertHexFloatingPointLiteralToBits(source); return Float.intBitsToFloat((int) bits); }
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {
/** * Returns the double value corresponding to the given * hexadecimal floating-point double precision literal. * The literal must be syntactially correct, and must be * a double literal (end in an optional 'd' or 'D'). * It must not include either leading or trailing whitespace or * a sign. * <p> * This method returns the same answer as * Double.parseDouble(new String(source)) does in JDK 1.5, * except that this method throw NumberFormatException in * the case of overflow to infinity or underflow to 0. * The method handles all the tricky cases, including * fraction rounding to 53 bits and gradual underflow. * </p> * * @param source source string containing double precision * hexadecimal floating-point literal * @return the double value, including Double.POSITIVE_INFINITY * if the non-zero value is too large to be represented, and * Double.NaN if the non-zero value is too small to be represented */ public static double valueOfHexDoubleLiteral(char[] source) { long bits = convertHexFloatingPointLiteralToBits(source); return Double.longBitsToDouble(bits); }
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {
/** * Returns the float value corresponding to the given * hexadecimal floating-point single precision literal. * The literal must be syntactically correct, and must be * a float literal (end in a 'f' or 'F'). It must not * include either leading or trailing whitespace or * a sign. * <p> * This method returns the same answer as * Float.parseFloat(new String(source)) does in JDK 1.5, * except that this method returns Floal.NaN if it * would underflow to 0 (parseFloat just returns 0). * The method handles all the tricky cases, including * fraction rounding to 24 bits and gradual underflow. * </p> * * @param source source string containing single precision * hexadecimal floating-point literal * @return the float value, including Float.POSITIVE_INFINITY * if the non-zero value is too large to be represented, and * Float.NaN if the non-zero value is too small to be represented */ public static float valueOfHexFloatLiteral(char[] source) { long bits = convertHexFloatingPointLiteralToBits(source); return Float.intBitsToFloat((int) bits); }
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {
/** * Returns the double value corresponding to the given * hexadecimal floating-point double precision literal. * The literal must be syntactially correct, and must be * a double literal (end in an optional 'd' or 'D'). * It must not include either leading or trailing whitespace or * a sign. * <p> * This method returns the same answer as * Double.parseDouble(new String(source)) does in JDK 1.5, * except that this method throw NumberFormatException in * the case of overflow to infinity or underflow to 0. * The method handles all the tricky cases, including * fraction rounding to 53 bits and gradual underflow. * </p> * * @param source source string containing double precision * hexadecimal floating-point literal * @return the double value, including Double.POSITIVE_INFINITY * if the non-zero value is too large to be represented, and * Double.NaN if the non-zero value is too small to be represented */ public static double valueOfHexDoubleLiteral(char[] source) { long bits = convertHexFloatingPointLiteralToBits(source); return Double.longBitsToDouble(bits); }
double v = FloatUtil.valueOfHexDoubleLiteral(this.source); if (v == Double.POSITIVE_INFINITY) {
float v = FloatUtil.valueOfHexFloatLiteral(this.source); if (v == Float.POSITIVE_INFINITY) {