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

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

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

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

            mpir.mpf_div_2exp(f, this, x);
            return(f);
        }
Ejemplo 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);
        }
Ejemplo n.º 6
0
        public virtual mpf Power(uint exponent)
        {
            var f = new mpf(precision: Precision);

            mpir.mpf_pow_ui(f, this, exponent);
            return(f);
        }
Ejemplo 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);
        }
Ejemplo n.º 8
0
        public virtual mpf Trunc()
        {
            var f = new mpf(precision: Precision);

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

            mpir.mpf_ui_sub(f, x, this);
            return(f);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 12
0
        public virtual mpf Subtract(uint x)
        {
            var f = new mpf(precision: Precision);

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

            mpir.mpf_add_ui(f, this, x);
            return(f);
        }
Ejemplo 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);
        }
Ejemplo n.º 15
0
        public virtual mpf DivideFrom(uint x)
        {
            var f = new mpf(precision: Precision);

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

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

            mpir.mpf_abs(f, this);
            return(f);
        }
Ejemplo 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);
        }
Ejemplo n.º 19
0
        public virtual mpf Ceil()
        {
            var f = new mpf(precision: Precision);

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

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