.class final Lcom/google/common/math/DoubleUtils; .super Ljava/lang/Object; .source "DoubleUtils.java" # annotations .annotation runtime Lcom/google/common/math/ElementTypesAreNonnullByDefault; .end annotation # static fields .field static final EXPONENT_BIAS:I = 0x3ff .field static final EXPONENT_MASK:J = 0x7ff0000000000000L .field static final IMPLICIT_BIT:J = 0x10000000000000L .field static final ONE_BITS:J = 0x3ff0000000000000L .field static final SIGNIFICAND_BITS:I = 0x34 .field static final SIGNIFICAND_MASK:J = 0xfffffffffffffL .field static final SIGN_MASK:J = -0x8000000000000000L # direct methods .method private constructor ()V .locals 0 .line 38 invoke-direct {p0}, Ljava/lang/Object;->()V return-void .end method .method static bigToDouble(Ljava/math/BigInteger;)D .locals 13 .line 90 invoke-virtual {p0}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger; move-result-object v0 .line 91 invoke-virtual {v0}, Ljava/math/BigInteger;->bitLength()I move-result v1 add-int/lit8 v2, v1, -0x1 const/16 v3, 0x3f if-ge v2, v3, :cond_0 .line 94 invoke-virtual {p0}, Ljava/math/BigInteger;->longValue()J move-result-wide v0 long-to-double v0, v0 return-wide v0 :cond_0 const/16 v3, 0x3ff if-le v2, v3, :cond_1 .line 96 invoke-virtual {p0}, Ljava/math/BigInteger;->signum()I move-result p0 int-to-double v0, p0 const-wide/high16 v2, 0x7ff0000000000000L # Double.POSITIVE_INFINITY mul-double/2addr v0, v2 return-wide v0 :cond_1 add-int/lit8 v2, v1, -0x36 .line 108 invoke-virtual {v0, v2}, Ljava/math/BigInteger;->shiftRight(I)Ljava/math/BigInteger; move-result-object v3 invoke-virtual {v3}, Ljava/math/BigInteger;->longValue()J move-result-wide v3 const/4 v5, 0x1 shr-long v5, v3, v5 const-wide v7, 0xfffffffffffffL and-long/2addr v7, v5 const-wide/16 v9, 0x1 and-long/2addr v3, v9 const-wide/16 v11, 0x0 cmp-long v3, v3, v11 if-eqz v3, :cond_3 and-long v3, v5, v9 cmp-long v3, v3, v11 if-nez v3, :cond_2 .line 118 invoke-virtual {v0}, Ljava/math/BigInteger;->getLowestSetBit()I move-result v0 if-ge v0, v2, :cond_3 :cond_2 add-long/2addr v7, v9 :cond_3 add-int/lit16 v1, v1, 0x3fe int-to-long v0, v1 const/16 v2, 0x34 shl-long/2addr v0, v2 add-long/2addr v0, v7 .line 128 invoke-virtual {p0}, Ljava/math/BigInteger;->signum()I move-result p0 int-to-long v2, p0 const-wide/high16 v4, -0x8000000000000000L and-long/2addr v2, v4 or-long/2addr v0, v2 .line 129 invoke-static {v0, v1}, Ljava/lang/Double;->longBitsToDouble(J)D move-result-wide v0 return-wide v0 .end method .method static ensureNonNegative(D)D .locals 2 .line 134 invoke-static {p0, p1}, Ljava/lang/Double;->isNaN(D)Z move-result v0 xor-int/lit8 v0, v0, 0x1 invoke-static {v0}, Lcom/google/common/base/Preconditions;->checkArgument(Z)V const-wide/16 v0, 0x0 .line 135 invoke-static {p0, p1, v0, v1}, Ljava/lang/Math;->max(DD)D move-result-wide p0 return-wide p0 .end method .method static getSignificand(D)J .locals 3 .line 64 invoke-static {p0, p1}, Lcom/google/common/math/DoubleUtils;->isFinite(D)Z move-result v0 const-string v1, "not a normal value" invoke-static {v0, v1}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/Object;)V .line 65 invoke-static {p0, p1}, Ljava/lang/Math;->getExponent(D)I move-result v0 .line 66 invoke-static {p0, p1}, Ljava/lang/Double;->doubleToRawLongBits(D)J move-result-wide p0 const-wide v1, 0xfffffffffffffL and-long/2addr p0, v1 const/16 v1, -0x3ff if-ne v0, v1, :cond_0 const/4 v0, 0x1 shl-long/2addr p0, v0 goto :goto_0 :cond_0 const-wide/high16 v0, 0x10000000000000L or-long/2addr p0, v0 :goto_0 return-wide p0 .end method .method static isFinite(D)Z .locals 0 .line 72 invoke-static {p0, p1}, Ljava/lang/Math;->getExponent(D)I move-result p0 const/16 p1, 0x3ff if-gt p0, p1, :cond_0 const/4 p0, 0x1 goto :goto_0 :cond_0 const/4 p0, 0x0 :goto_0 return p0 .end method .method static isNormal(D)Z .locals 0 .line 76 invoke-static {p0, p1}, Ljava/lang/Math;->getExponent(D)I move-result p0 const/16 p1, -0x3fe if-lt p0, p1, :cond_0 const/4 p0, 0x1 goto :goto_0 :cond_0 const/4 p0, 0x0 :goto_0 return p0 .end method .method static nextDown(D)D .locals 0 neg-double p0, p0 .line 41 invoke-static {p0, p1}, Ljava/lang/Math;->nextUp(D)D move-result-wide p0 neg-double p0, p0 return-wide p0 .end method .method static scaleNormalize(D)D .locals 2 .line 84 invoke-static {p0, p1}, Ljava/lang/Double;->doubleToRawLongBits(D)J move-result-wide p0 const-wide v0, 0xfffffffffffffL and-long/2addr p0, v0 const-wide/high16 v0, 0x3ff0000000000000L # 1.0 or-long/2addr p0, v0 .line 85 invoke-static {p0, p1}, Ljava/lang/Double;->longBitsToDouble(J)D move-result-wide p0 return-wide p0 .end method