Exemple #1
0
        public virtual mpf Sqrt()
        {
            var f = new mpf(precision: Precision);

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

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

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

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

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

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

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

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

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

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

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

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

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

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