public final class com.google.common.math.DoubleMath extends java.lang.Object
{
private static final double MIN_INT_AS_DOUBLE;
private static final double MAX_INT_AS_DOUBLE;
private static final double MIN_LONG_AS_DOUBLE;
private static final double MAX_LONG_AS_DOUBLE_PLUS_ONE;
private static final double LN_2;
static final int MAX_FACTORIAL;
static final double[] everySixteenthFactorial;
static double roundIntermediate(double, java.math.RoundingMode)
{
long v, v, v;
java.lang.AssertionError v;
byte v, v, v, v, v, v;
int[] v;
int v, v;
java.lang.ArithmeticException v;
boolean v, v, v, v, v;
double v, v, v, v, v, v, v, v, v, v;
java.math.RoundingMode v;
v := @parameter: double;
v := @parameter: java.math.RoundingMode;
v = staticinvoke <com.google.common.math.DoubleUtils: boolean isFinite(double)>(v);
if v != 0 goto label;
v = new java.lang.ArithmeticException;
specialinvoke v.<java.lang.ArithmeticException: void <init>(java.lang.String)>("input is infinite or NaN");
throw v;
label:
v = <com.google.common.math.DoubleMath$1: int[] $SwitchMap$java$math$RoundingMode>;
v = virtualinvoke v.<java.math.RoundingMode: int ordinal()>();
v = v[v];
tableswitch(v)
{
case 1: goto label;
case 2: goto label;
case 3: goto label;
case 4: goto label;
case 5: goto label;
case 6: goto label;
case 7: goto label;
case 8: goto label;
default: goto label;
};
label:
v = staticinvoke <com.google.common.math.DoubleMath: boolean isMathematicalInteger(double)>(v);
staticinvoke <com.google.common.math.MathPreconditions: void checkRoundingUnnecessary(boolean)>(v);
return v;
label:
v = v cmpl 0.0;
if v >= 0 goto label;
v = staticinvoke <com.google.common.math.DoubleMath: boolean isMathematicalInteger(double)>(v);
if v == 0 goto label;
label:
return v;
label:
v = v - 1L;
return v;
label:
v = v cmpg 0.0;
if v <= 0 goto label;
v = staticinvoke <com.google.common.math.DoubleMath: boolean isMathematicalInteger(double)>(v);
if v == 0 goto label;
label:
return v;
label:
v = v + 1L;
return v;
label:
return v;
label:
v = staticinvoke <com.google.common.math.DoubleMath: boolean isMathematicalInteger(double)>(v);
if v == 0 goto label;
return v;
label:
v = v cmpl 0.0;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = -1;
label:
v = v + v;
return v;
label:
v = staticinvoke <java.lang.Math: double rint(double)>(v);
return v;
label:
v = staticinvoke <java.lang.Math: double rint(double)>(v);
v = v - v;
v = staticinvoke <java.lang.Math: double abs(double)>(v);
v = v cmpl 0.5;
if v != 0 goto label;
v = staticinvoke <java.lang.Math: double copySign(double,double)>(0.5, v);
v = v + v;
return v;
label:
return v;
label:
v = staticinvoke <java.lang.Math: double rint(double)>(v);
v = v - v;
v = staticinvoke <java.lang.Math: double abs(double)>(v);
v = v cmpl 0.5;
if v != 0 goto label;
return v;
label:
return v;
label:
v = new java.lang.AssertionError;
specialinvoke v.<java.lang.AssertionError: void <init>()>();
throw v;
}
public static int roundToInt(double, java.math.RoundingMode)
{
byte v, v;
boolean v, v, v;
double v, v;
java.math.RoundingMode v;
v := @parameter: double;
v := @parameter: java.math.RoundingMode;
v = staticinvoke <com.google.common.math.DoubleMath: double roundIntermediate(double,java.math.RoundingMode)>(v, v);
v = v cmpl -2.147483649E9;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v cmpg 2.147483648E9;
if v >= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v & v;
staticinvoke <com.google.common.math.MathPreconditions: void checkInRangeForRoundingInputs(boolean,double,java.math.RoundingMode)>(v, v, v);
return v;
}
public static long roundToLong(double, java.math.RoundingMode)
{
byte v, v;
boolean v, v, v;
double v, v, v;
java.math.RoundingMode v;
v := @parameter: double;
v := @parameter: java.math.RoundingMode;
v = staticinvoke <com.google.common.math.DoubleMath: double roundIntermediate(double,java.math.RoundingMode)>(v, v);
v = -9.223372036854776E18 - v;
v = v cmpg 1.0;
if v >= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v cmpg 9.223372036854776E18;
if v >= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v & v;
staticinvoke <com.google.common.math.MathPreconditions: void checkInRangeForRoundingInputs(boolean,double,java.math.RoundingMode)>(v, v, v);
return v;
}
public static java.math.BigInteger roundToBigInteger(double, java.math.RoundingMode)
{
long v;
byte v, v, v;
int v, v;
java.math.BigInteger v, v, v, v;
boolean v, v, v;
double v, v, v;
java.math.RoundingMode v;
v := @parameter: double;
v := @parameter: java.math.RoundingMode;
v = staticinvoke <com.google.common.math.DoubleMath: double roundIntermediate(double,java.math.RoundingMode)>(v, v);
v = -9.223372036854776E18 - v;
v = v cmpg 1.0;
if v >= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v cmpg 9.223372036854776E18;
if v >= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v & v;
if v == 0 goto label;
v = staticinvoke <java.math.BigInteger: java.math.BigInteger valueOf(long)>(v);
return v;
label:
v = staticinvoke <java.lang.Math: int getExponent(double)>(v);
v = staticinvoke <com.google.common.math.DoubleUtils: long getSignificand(double)>(v);
v = staticinvoke <java.math.BigInteger: java.math.BigInteger valueOf(long)>(v);
v = v - 52;
v = virtualinvoke v.<java.math.BigInteger: java.math.BigInteger shiftLeft(int)>(v);
v = v cmpg 0.0;
if v >= 0 goto label;
v = virtualinvoke v.<java.math.BigInteger: java.math.BigInteger negate()>();
goto label;
label:
v = v;
label:
return v;
}
public static boolean isPowerOfTwo(double)
{
long v, v, v;
byte v, v;
boolean v, v;
double v;
v := @parameter: double;
v = v cmpl 0.0;
if v <= 0 goto label;
v = staticinvoke <com.google.common.math.DoubleUtils: boolean isFinite(double)>(v);
if v == 0 goto label;
v = staticinvoke <com.google.common.math.DoubleUtils: long getSignificand(double)>(v);
v = v - 1L;
v = v & v;
v = v cmp 0L;
if v != 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
return v;
label:
return 0;
}
public static double log2(double)
{
double v, v, v, v;
v := @parameter: double;
v = staticinvoke <java.lang.Math: double log(double)>(v);
v = <com.google.common.math.DoubleMath: double LN_2>;
v = v / v;
return v;
}
public static int log2(double, java.math.RoundingMode)
{
java.lang.AssertionError v;
byte v, v;
int[] v;
int v, v, v, v, v, v;
boolean v, v, v, v, v, v, v, v, v, v, v, v, v, v;
double v, v, v, v;
java.math.RoundingMode v;
v := @parameter: double;
v := @parameter: java.math.RoundingMode;
v = v cmpl 0.0;
if v <= 0 goto label;
v = staticinvoke <com.google.common.math.DoubleUtils: boolean isFinite(double)>(v);
if v == 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "x must be positive and finite");
v = staticinvoke <java.lang.Math: int getExponent(double)>(v);
v = staticinvoke <com.google.common.math.DoubleUtils: boolean isNormal(double)>(v);
if v != 0 goto label;
v = v * 4.503599627370496E15;
v = staticinvoke <com.google.common.math.DoubleMath: int log2(double,java.math.RoundingMode)>(v, v);
v = v - 52;
return v;
label:
v = <com.google.common.math.DoubleMath$1: int[] $SwitchMap$java$math$RoundingMode>;
v = virtualinvoke v.<java.math.RoundingMode: int ordinal()>();
v = v[v];
tableswitch(v)
{
case 1: goto label;
case 2: goto label;
case 3: goto label;
case 4: goto label;
case 5: goto label;
case 6: goto label;
case 7: goto label;
case 8: goto label;
default: goto label;
};
label:
v = staticinvoke <com.google.common.math.DoubleMath: boolean isPowerOfTwo(double)>(v);
staticinvoke <com.google.common.math.MathPreconditions: void checkRoundingUnnecessary(boolean)>(v);
label:
v = 0;
goto label;
label:
v = staticinvoke <com.google.common.math.DoubleMath: boolean isPowerOfTwo(double)>(v);
if v != 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v;
goto label;
label:
if v >= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = staticinvoke <com.google.common.math.DoubleMath: boolean isPowerOfTwo(double)>(v);
if v != 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v & v;
goto label;
label:
if v < 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = staticinvoke <com.google.common.math.DoubleMath: boolean isPowerOfTwo(double)>(v);
if v != 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v & v;
goto label;
label:
v = staticinvoke <com.google.common.math.DoubleUtils: double scaleNormalize(double)>(v);
v = v * v;
v = v cmpl 2.0;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = v;
goto label;
label:
v = new java.lang.AssertionError;
specialinvoke v.<java.lang.AssertionError: void <init>()>();
throw v;
label:
if v == 0 goto label;
v = v + 1;
goto label;
label:
v = v;
label:
return v;
}
public static boolean isMathematicalInteger(double)
{
long v;
byte v;
int v, v, v;
boolean v, v;
double v;
v := @parameter: double;
v = staticinvoke <com.google.common.math.DoubleUtils: boolean isFinite(double)>(v);
if v == 0 goto label;
v = v cmpl 0.0;
if v == 0 goto label;
v = staticinvoke <com.google.common.math.DoubleUtils: long getSignificand(double)>(v);
v = staticinvoke <java.lang.Long: int numberOfTrailingZeros(long)>(v);
v = 52 - v;
v = staticinvoke <java.lang.Math: int getExponent(double)>(v);
if v > v goto label;
label:
v = 1;
goto label;
label:
v = 0;
label:
return v;
}
public static double factorial(int)
{
double[] v;
int v, v, v, v, v;
double v, v, v;
v := @parameter: int;
staticinvoke <com.google.common.math.MathPreconditions: int checkNonNegative(java.lang.String,int)>("n", v);
if v <= 170 goto label;
return #Infinity;
label:
v = 1.0;
v = (int) -16;
v = v & v;
v = 1 + v;
label:
if v > v goto label;
v = v * v;
v = v + 1;
goto label;
label:
v = <com.google.common.math.DoubleMath: double[] everySixteenthFactorial>;
v = v >> 4;
v = v[v];
v = v * v;
return v;
}
public static boolean fuzzyEquals(double, double, double)
{
byte v, v;
boolean v, v, v;
double v, v, v, v, v;
v := @parameter: double;
v := @parameter: double;
v := @parameter: double;
staticinvoke <com.google.common.math.MathPreconditions: double checkNonNegative(java.lang.String,double)>("tolerance", v);
v = v - v;
v = staticinvoke <java.lang.Math: double copySign(double,double)>(v, 1.0);
v = v cmpg v;
if v <= 0 goto label;
v = v cmpl v;
if v == 0 goto label;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v == 0 goto label;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v == 0 goto label;
label:
v = 1;
goto label;
label:
v = 0;
label:
return v;
}
public static int fuzzyCompare(double, double, double)
{
byte v, v;
int v, v;
boolean v, v, v;
double v, v, v;
v := @parameter: double;
v := @parameter: double;
v := @parameter: double;
v = staticinvoke <com.google.common.math.DoubleMath: boolean fuzzyEquals(double,double,double)>(v, v, v);
if v == 0 goto label;
return 0;
label:
v = v cmpg v;
if v >= 0 goto label;
v = (int) -1;
return v;
label:
v = v cmpl v;
if v <= 0 goto label;
return 1;
label:
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
v = staticinvoke <com.google.common.primitives.Booleans: int compare(boolean,boolean)>(v, v);
return v;
}
public static transient double mean(double[])
{
double[] v;
long v;
int v, v, v;
boolean v;
double v, v, v, v, v, v;
v := @parameter: double[];
v = lengthof v;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "Cannot take mean of 0 values");
v = 1L;
v = v[0];
v = staticinvoke <com.google.common.math.DoubleMath: double checkFinite(double)>(v);
v = 1;
label:
v = lengthof v;
if v >= v goto label;
v = v[v];
staticinvoke <com.google.common.math.DoubleMath: double checkFinite(double)>(v);
v = v + 1L;
v = v[v];
v = v - v;
v = v / v;
v = v + v;
v = v + 1;
goto label;
label:
return v;
}
public static transient double mean(int[])
{
long v;
int[] v;
int v, v, v, v, v;
boolean v;
double v;
v := @parameter: int[];
v = lengthof v;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "Cannot take mean of 0 values");
v = 0L;
v = 0;
label:
v = lengthof v;
if v >= v goto label;
v = v[v];
v = v + v;
v = v + 1;
goto label;
label:
v = lengthof v;
v = v / v;
return v;
}
public static transient double mean(long[])
{
long v, v, v;
long[] v;
int v, v, v;
boolean v;
double v, v;
v := @parameter: long[];
v = lengthof v;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "Cannot take mean of 0 values");
v = 1L;
v = v[0];
v = 1;
label:
v = lengthof v;
if v >= v goto label;
v = v + 1L;
v = v[v];
v = v - v;
v = v / v;
v = v + v;
v = v + 1;
goto label;
label:
return v;
}
public static double mean(java.lang.Iterable)
{
java.util.Iterator v;
java.lang.Iterable v;
double v;
v := @parameter: java.lang.Iterable;
v = interfaceinvoke v.<java.lang.Iterable: java.util.Iterator iterator()>();
v = staticinvoke <com.google.common.math.DoubleMath: double mean(java.util.Iterator)>(v);
return v;
}
public static double mean(java.util.Iterator)
{
java.util.Iterator v;
long v;
java.lang.Object v, v;
boolean v, v;
double v, v, v, v, v, v;
v := @parameter: java.util.Iterator;
v = interfaceinvoke v.<java.util.Iterator: boolean hasNext()>();
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "Cannot take mean of 0 values");
v = 1L;
v = interfaceinvoke v.<java.util.Iterator: java.lang.Object next()>();
v = virtualinvoke v.<java.lang.Number: double doubleValue()>();
v = staticinvoke <com.google.common.math.DoubleMath: double checkFinite(double)>(v);
label:
v = interfaceinvoke v.<java.util.Iterator: boolean hasNext()>();
if v == 0 goto label;
v = interfaceinvoke v.<java.util.Iterator: java.lang.Object next()>();
v = virtualinvoke v.<java.lang.Number: double doubleValue()>();
v = staticinvoke <com.google.common.math.DoubleMath: double checkFinite(double)>(v);
v = v + 1L;
v = v - v;
v = v / v;
v = v + v;
goto label;
label:
return v;
}
private static double checkFinite(double)
{
boolean v;
double v;
v := @parameter: double;
v = staticinvoke <com.google.common.math.DoubleUtils: boolean isFinite(double)>(v);
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean)>(v);
return v;
}
private void <init>()
{
com.google.common.math.DoubleMath v;
v := @this: com.google.common.math.DoubleMath;
specialinvoke v.<java.lang.Object: void <init>()>();
return;
}
static void <clinit>()
{
double[] v;
double v;
v = staticinvoke <java.lang.Math: double log(double)>(2.0);
<com.google.common.math.DoubleMath: double LN_2> = v;
v = newarray (double)[11];
v[0] = 1.0;
v[1] = 2.0922789888E13;
v[2] = 2.631308369336935E35;
v[3] = 1.2413915592536073E61;
v[4] = 1.2688693218588417E89;
v[5] = 7.156945704626381E118;
v[6] = 9.916779348709496E149;
v[7] = 1.974506857221074E182;
v[8] = 3.856204823625804E215;
v[9] = 5.5502938327393044E249;
v[10] = 4.7147236359920616E284;
<com.google.common.math.DoubleMath: double[] everySixteenthFactorial> = v;
return;
}
}