public static double ConvertToDouble(BigInteger self) { return self.ToFloat64(); }
public static float ToFloat(BigInteger/*!*/ self) { return checked((float)self.ToFloat64()); }
public static double ToFloat(RubyContext/*!*/ context, BigInteger/*!*/ self) { try { return self.ToFloat64(); } catch (OverflowException) { // If the BigInteger is too big for a float then we return infinity. context.ReportWarning("Bignum out of Float range"); return self.Sign > 0 ? Double.PositiveInfinity : Double.NegativeInfinity; } }
public static object __float__(BigInteger self) { return self.ToFloat64(); }
public static object Power(BigInteger/*!*/ self, double exponent) { return System.Math.Pow(self.ToFloat64(), exponent); }
public static object Add(BigInteger/*!*/ self, double other) { return self.ToFloat64() + other; }
public static object Quotient(BigInteger/*!*/ self, double other) { return self.ToFloat64() / other; }
public static object Power(RubyContext/*!*/ context, BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ exponent) { context.ReportWarning("in a**b, b may be too big"); double result = System.Math.Pow(self.ToFloat64(), exponent.ToFloat64()); return result; }
public static object Subtract(BigInteger/*!*/ self, double other) { return self.ToFloat64() - other; }
public static object Multiply(BigInteger/*!*/ self, double other) { return self.ToFloat64() * other; }
public static double ConvertToDouble(BigInteger self) { if (object.ReferenceEquals(self, null)) { throw new ArgumentNullException("self"); } return self.ToFloat64(); }
public static double ConvertBignumToFloat(BigInteger/*!*/ value) { return value.ToFloat64(); }
public static double Remainder(BigInteger/*!*/ self, double other) { return self.ToFloat64() % other; }
public static RubyArray DivMod(BigInteger/*!*/ self, double other) { if (other == 0.0) { throw new FloatDomainError("NaN"); } double selfFloat = self.ToFloat64(); BigInteger div = BigInteger.Create(selfFloat / other); double mod = selfFloat % other; return RubyOps.MakeArray2(Protocols.Normalize(div), mod); }
public static object DivideOp(BigInteger/*!*/ self, double other) { return self.ToFloat64() / other; }