< prev index next >

src/java.base/share/classes/java/lang/Float.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1994, 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. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1994, 2016, 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. Oracle designates this
*** 24,35 **** */ package java.lang; import jdk.internal.math.FloatingDecimal; - import jdk.internal.math.FloatConsts; - import jdk.internal.math.DoubleConsts; import jdk.internal.HotSpotIntrinsicCandidate; /** * The {@code Float} class wraps a value of primitive type * {@code float} in an object. An object of type --- 24,33 ----
*** 280,298 **** * @return a hex string representation of the argument. * @since 1.5 * @author Joseph D. Darcy */ public static String toHexString(float f) { ! if (Math.abs(f) < FloatConsts.MIN_NORMAL && f != 0.0f ) {// float subnormal // Adjust exponent to create subnormal double, then // replace subnormal double exponent with subnormal float // exponent String s = Double.toHexString(Math.scalb((double)f, /* -1022+126 */ ! DoubleConsts.MIN_EXPONENT- ! FloatConsts.MIN_EXPONENT)); return s.replaceFirst("p-1022$", "p-126"); } else // double string will be the same as float string return Double.toHexString(f); } --- 278,296 ---- * @return a hex string representation of the argument. * @since 1.5 * @author Joseph D. Darcy */ public static String toHexString(float f) { ! if (Math.abs(f) < Float.MIN_NORMAL && f != 0.0f ) {// float subnormal // Adjust exponent to create subnormal double, then // replace subnormal double exponent with subnormal float // exponent String s = Double.toHexString(Math.scalb((double)f, /* -1022+126 */ ! Double.MIN_EXPONENT- ! Float.MIN_EXPONENT)); return s.replaceFirst("p-1022$", "p-126"); } else // double string will be the same as float string return Double.toHexString(f); }
*** 487,497 **** * @return {@code true} if the argument is a finite * floating-point value, {@code false} otherwise. * @since 1.8 */ public static boolean isFinite(float f) { ! return Math.abs(f) <= FloatConsts.MAX_VALUE; } /** * The value of the Float. * --- 485,495 ---- * @return {@code true} if the argument is a finite * floating-point value, {@code false} otherwise. * @since 1.8 */ public static boolean isFinite(float f) { ! return Math.abs(f) <= Float.MAX_VALUE; } /** * The value of the Float. *
< prev index next >