Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/misc/DoubleConsts.java
38829 views
/*1* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.misc;2627/**28* This class contains additional constants documenting limits of the29* <code>double</code> type.30*31* @author Joseph D. Darcy32*/3334public class DoubleConsts {35/**36* Don't let anyone instantiate this class.37*/38private DoubleConsts() {}3940public static final double POSITIVE_INFINITY = java.lang.Double.POSITIVE_INFINITY;41public static final double NEGATIVE_INFINITY = java.lang.Double.NEGATIVE_INFINITY;42public static final double NaN = java.lang.Double.NaN;43public static final double MAX_VALUE = java.lang.Double.MAX_VALUE;44public static final double MIN_VALUE = java.lang.Double.MIN_VALUE;4546/**47* A constant holding the smallest positive normal value of type48* <code>double</code>, 2<sup>-1022</sup>. It is equal to the49* value returned by50* <code>Double.longBitsToDouble(0x0010000000000000L)</code>.51*52* @since 1.553*/54public static final double MIN_NORMAL = 2.2250738585072014E-308;555657/**58* The number of logical bits in the significand of a59* <code>double</code> number, including the implicit bit.60*/61public static final int SIGNIFICAND_WIDTH = 53;6263/**64* Maximum exponent a finite <code>double</code> number may have.65* It is equal to the value returned by66* <code>Math.ilogb(Double.MAX_VALUE)</code>.67*/68public static final int MAX_EXPONENT = 1023;6970/**71* Minimum exponent a normalized <code>double</code> number may72* have. It is equal to the value returned by73* <code>Math.ilogb(Double.MIN_NORMAL)</code>.74*/75public static final int MIN_EXPONENT = -1022;7677/**78* The exponent the smallest positive <code>double</code>79* subnormal value would have if it could be normalized. It is80* equal to the value returned by81* <code>FpUtils.ilogb(Double.MIN_VALUE)</code>.82*/83public static final int MIN_SUB_EXPONENT = MIN_EXPONENT -84(SIGNIFICAND_WIDTH - 1);8586/**87* Bias used in representing a <code>double</code> exponent.88*/89public static final int EXP_BIAS = 1023;9091/**92* Bit mask to isolate the sign bit of a <code>double</code>.93*/94public static final long SIGN_BIT_MASK = 0x8000000000000000L;9596/**97* Bit mask to isolate the exponent field of a98* <code>double</code>.99*/100public static final long EXP_BIT_MASK = 0x7FF0000000000000L;101102/**103* Bit mask to isolate the significand field of a104* <code>double</code>.105*/106public static final long SIGNIF_BIT_MASK = 0x000FFFFFFFFFFFFFL;107108static {109// verify bit masks cover all bit positions and that the bit110// masks are non-overlapping111assert(((SIGN_BIT_MASK | EXP_BIT_MASK | SIGNIF_BIT_MASK) == ~0L) &&112(((SIGN_BIT_MASK & EXP_BIT_MASK) == 0L) &&113((SIGN_BIT_MASK & SIGNIF_BIT_MASK) == 0L) &&114((EXP_BIT_MASK & SIGNIF_BIT_MASK) == 0L)));115}116}117118119