ToFloat64() public method

public ToFloat64 ( ) : double
return double
示例#1
0
 public static double ConvertToDouble(BigInteger self) {
     return self.ToFloat64();
 }
示例#2
0
 public static float ToFloat(BigInteger/*!*/ self) {
     return checked((float)self.ToFloat64());
 }
示例#3
0
 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;
     }
 }
示例#4
0
 public static object __float__(BigInteger self) {
     return self.ToFloat64();
 }
示例#5
0
 public static object Power(BigInteger/*!*/ self, double exponent) {
     return System.Math.Pow(self.ToFloat64(), exponent);
 }
示例#6
0
 public static object Add(BigInteger/*!*/ self, double other) {
     return self.ToFloat64() + other;
 }
示例#7
0
 public static object Quotient(BigInteger/*!*/ self, double other) {
     return self.ToFloat64() / other;
 }
示例#8
0
 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;
 }
示例#9
0
 public static object Subtract(BigInteger/*!*/ self, double other) {
     return self.ToFloat64() - other;
 }
示例#10
0
 public static object Multiply(BigInteger/*!*/ self, double other) {
     return self.ToFloat64() * other;
 }
示例#11
0
 public static double ConvertToDouble(BigInteger self) {
     if (object.ReferenceEquals(self, null)) {
         throw new ArgumentNullException("self");
     }
     return self.ToFloat64();
 }
示例#12
0
 public static double ConvertBignumToFloat(BigInteger/*!*/ value) {
     return value.ToFloat64();
 }
示例#13
0
 public static double Remainder(BigInteger/*!*/ self, double other) {
     return self.ToFloat64() % other;
 }
示例#14
0
        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);
        }
示例#15
0
 public static object DivideOp(BigInteger/*!*/ self, double other) {
     return self.ToFloat64() / other;
 }