Esempio n. 1
0
        public virtual mpf Sqrt()
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_sqrt(f, this);
            return(f);
        }
Esempio n. 2
0
        public static mpf Sqrt(uint x)
        {
            var f = new mpf(precision: DefaultPrecision);

            mpir.mpf_sqrt_ui(f, x);
            return(f);
        }
Esempio n. 3
0
        public virtual mpf MultiplyBy2Exp(uint x)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_mul_2exp(f, this, x);
            return(f);
        }
Esempio n. 4
0
        public virtual mpf DivideBy2Exp(uint x)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_div_2exp(f, this, x);
            return(f);
        }
Esempio n. 5
0
        public static mpf GetBiasedRandomBits(randstate state, long maxSize, long exp)
        {
            var f = new mpf(precision: DefaultPrecision);

            mpir.mpf_rrandomb(f, state, maxSize, exp);
            return(f);
        }
Esempio n. 6
0
        public virtual mpf Power(uint exponent)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_pow_ui(f, this, exponent);
            return(f);
        }
Esempio n. 7
0
        public virtual mpf DivideFrom(mpf x)
        {
            var f = new mpf(precision: Math.Max(Precision, x.Precision));

            mpir.mpf_div(f, x, this);
            return(f);
        }
Esempio n. 8
0
        public virtual mpf Trunc()
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_trunc(f, this);
            return(f);
        }
Esempio n. 9
0
        public virtual mpf SubtractFrom(uint x)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_ui_sub(f, x, this);
            return(f);
        }
Esempio n. 10
0
        public virtual mpf Multiply(mpf x)
        {
            var f = new mpf(precision: Math.Max(Precision, x.Precision));

            mpir.mpf_mul(f, this, x);
            return(f);
        }
Esempio n. 11
0
        public virtual mpf SubtractFrom(mpf x)
        {
            var f = new mpf(precision: Math.Max(Precision, x.Precision));

            mpir.mpf_sub(f, x, this);
            return(f);
        }
Esempio n. 12
0
        public virtual mpf Subtract(uint x)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_sub_ui(f, this, x);
            return(f);
        }
Esempio n. 13
0
        public virtual mpf Add(uint x)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_add_ui(f, this, x);
            return(f);
        }
Esempio n. 14
0
        public virtual mpf Add(mpf x)
        {
            var f = new mpf(precision: Math.Max(Precision, x.Precision));

            mpir.mpf_add(f, this, x);
            return(f);
        }
Esempio n. 15
0
        public virtual mpf DivideFrom(uint x)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_ui_div(f, x, this);
            return(f);
        }
Esempio n. 16
0
        public virtual mpf Floor()
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_floor(f, this);
            return(f);
        }
Esempio n. 17
0
        public virtual mpf Abs()
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_abs(f, this);
            return(f);
        }
Esempio n. 18
0
        public static mpf GetUniformlyDistributedRandomBits(randstate state, ulong nbits)
        {
            var f = new mpf(precision: Math.Max(DefaultPrecision, nbits));

            mpir.mpf_urandomb(f, state, nbits);
            return(f);
        }
Esempio n. 19
0
        public virtual mpf Ceil()
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_ceil(f, this);
            return(f);
        }
Esempio n. 20
0
        public virtual mpf Negate()
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_neg(f, this);
            return(f);
        }
Esempio n. 21
0
        public virtual mpf RelativeDifference(mpf other)
        {
            var f = new mpf(precision: Math.Max(Precision, other.Precision));

            mpir.mpf_reldiff(f, this, other);
            return(f);
        }
Esempio n. 22
0
 public int CompareTo(mpf other)
 {
     return(CompareTo(other.ToMpq()));
 }
Esempio n. 23
0
 public bool Equals(mpf other)
 {
     return(!ReferenceEquals(other, null) && Equals(other.ToMpq()));
 }
Esempio n. 24
0
 public mpq(mpf op) : this()
 {
     mpir.mpq_set_f(this, op);
     mpir.mpq_canonicalize(this);
 }
Esempio n. 25
0
 public static int Compare(double x, mpf y)
 {
     return(-y.CompareTo(x));
 }
Esempio n. 26
0
 public static int Compare(mpf x, double y)
 {
     return(x.CompareTo(y));
 }
Esempio n. 27
0
 public static int Compare(uint x, mpf y)
 {
     return(-y.CompareTo(x));
 }
Esempio n. 28
0
 public static int Compare(mpf x, uint y)
 {
     return(x.CompareTo(y));
 }
Esempio n. 29
0
 public int CompareTo(mpf other)
 {
     return(Math.Sign(mpir.mpf_cmp(this, other)));
 }
Esempio n. 30
0
 public bool Equals(mpf other, ulong bits)
 {
     return(!ReferenceEquals(other, null) &&
            (ReferenceEquals(this, other) || (mpir.mpf_eq(this, other, bits) != 0)));
 }