Path: blob/master/src/java.base/share/classes/jdk/internal/math/DoubleConsts.java
41159 views
/*1* Copyright (c) 2003, 2016, 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 jdk.internal.math;2627/**28* This class contains additional constants documenting limits of the29* {@code double} type.30*31* @author Joseph D. Darcy32*/3334public class DoubleConsts {35/**36* Don't let anyone instantiate this class.37*/38private DoubleConsts() {}3940/**41* The number of logical bits in the significand of a42* {@code double} number, including the implicit bit.43*/44public static final int SIGNIFICAND_WIDTH = 53;4546/**47* The exponent the smallest positive {@code double}48* subnormal value would have if it could be normalized..49*/50public static final int MIN_SUB_EXPONENT = Double.MIN_EXPONENT -51(SIGNIFICAND_WIDTH - 1);5253/**54* Bias used in representing a {@code double} exponent.55*/56public static final int EXP_BIAS = 1023;5758/**59* Bit mask to isolate the sign bit of a {@code double}.60*/61public static final long SIGN_BIT_MASK = 0x8000000000000000L;6263/**64* Bit mask to isolate the exponent field of a65* {@code double}.66*/67public static final long EXP_BIT_MASK = 0x7FF0000000000000L;6869/**70* Bit mask to isolate the significand field of a71* {@code double}.72*/73public static final long SIGNIF_BIT_MASK = 0x000FFFFFFFFFFFFFL;7475static {76// verify bit masks cover all bit positions and that the bit77// masks are non-overlapping78assert(((SIGN_BIT_MASK | EXP_BIT_MASK | SIGNIF_BIT_MASK) == ~0L) &&79(((SIGN_BIT_MASK & EXP_BIT_MASK) == 0L) &&80((SIGN_BIT_MASK & SIGNIF_BIT_MASK) == 0L) &&81((EXP_BIT_MASK & SIGNIF_BIT_MASK) == 0L)));82}83}848586