public static double MaximumCommonMantissa(double d1, double d2) { if (d1 == 0.0 || d2 == 0.0) { return(0.0); } DoubleBits db1 = new DoubleBits(d1); DoubleBits db2 = new DoubleBits(d2); if (db1.GetExponent() != db2.GetExponent()) { return(0.0); } int maxCommon = db1.NumCommonMantissaBits(db2); db1.ZeroLowerBits(64 - (12 + maxCommon)); return(db1.GetDouble()); }
public static int Exponent(double d) { DoubleBits db = new DoubleBits(d); return(db.GetExponent()); }