Beispiel #1
0
        public virtual mpq Multiply(mpq x)
        {
            var q = new mpq();

            mpir.mpq_mul(q, this, x);
            return(q);
        }
Beispiel #2
0
        public virtual mpq MultiplyBy2Exp(uint x)
        {
            var q = new mpq();

            mpir.mpq_mul_2exp(q, this, x);
            return(q);
        }
Beispiel #3
0
        public virtual mpq Subtract(mpq x)
        {
            var q = new mpq();

            mpir.mpq_sub(q, this, x);
            return(q);
        }
Beispiel #4
0
        public virtual mpq Negate()
        {
            var q = new mpq();

            mpir.mpq_neg(q, this);
            return(q);
        }
Beispiel #5
0
        public virtual mpq DivideFrom(mpq x)
        {
            var q = new mpq();

            mpir.mpq_div(q, x, this);
            return(q);
        }
Beispiel #6
0
        public virtual mpq Divide(mpq x)
        {
            var q = new mpq();

            mpir.mpq_div(q, this, x);
            return(q);
        }
Beispiel #7
0
        public virtual mpq DivideBy2Exp(uint x)
        {
            var q = new mpq();

            mpir.mpq_div_2exp(q, this, x);
            return(q);
        }
Beispiel #8
0
        public virtual mpq Inverse()
        {
            var q = new mpq();

            mpir.mpq_inv(q, this);
            return(q);
        }
Beispiel #9
0
        public virtual mpq Abs()
        {
            var q = new mpq();

            mpir.mpq_abs(q, this);
            return(q);
        }
Beispiel #10
0
        public virtual mpq Add(mpq x)
        {
            var q = new mpq();

            mpir.mpq_add(q, this, x);
            return(q);
        }
Beispiel #11
0
        public virtual mpq SubtractFrom(mpq x)
        {
            var q = new mpq();

            mpir.mpq_sub(q, x, this);
            return(q);
        }
Beispiel #12
0
        public virtual mpq Root(uint n, out bool isExact)
        {
            bool isNumExact;
            bool isDenExact;

            var ans = new mpq(Numerator.Root(n, out isNumExact), Denominator.Root(n, out isDenExact));

            isExact = isNumExact && isDenExact;

            return(ans);
        }
Beispiel #13
0
        public virtual mpq Sqrt(out bool isExact)
        {
            bool isNumExact;
            bool isDenExact;

            var ans = new mpq(Numerator.Sqrt(out isNumExact), Denominator.Sqrt(out isDenExact));

            isExact = isNumExact && isDenExact;

            return(ans);
        }
Beispiel #14
0
 public static int Compare(mpq x, double y)
 {
     return(x.CompareTo(y));
 }
Beispiel #15
0
 public override mpq Multiply(mpq x)
 {
     mpir.mpq_mul(this, this, x);
     return(this);
 }
Beispiel #16
0
 public mpq(mpq op) : this()
 {
     mpir.mpq_set(this, op);
 }
Beispiel #17
0
 public override mpq Divide(mpq x)
 {
     mpir.mpq_div(this, this, x);
     return(this);
 }
Beispiel #18
0
 public bool Equals(mpq other)
 {
     return(!ReferenceEquals(other, null) && Equals(other.ToMpf()));
 }
Beispiel #19
0
 public mpf(mpq op, ulong?precision = null) : this(precision : precision)
 {
     mpir.mpf_set_q(this, op);
 }
Beispiel #20
0
 public int CompareTo(mpq other)
 {
     return(CompareTo(other.ToMpf()));
 }
Beispiel #21
0
 public override mpq SubtractFrom(mpq x)
 {
     mpir.mpq_sub(this, x, this);
     return(this);
 }
Beispiel #22
0
 public static int Compare(mpq x, uint y)
 {
     return(x.CompareTo(y));
 }
Beispiel #23
0
 public bool Equals(mpq other)
 {
     return(!ReferenceEquals(other, null) &&
            (ReferenceEquals(this, other) || (mpir.mpq_equal(this, other) != 0)));
 }
Beispiel #24
0
 public override mpfr Add(mpq x, RoundingMode?roundingMode = null)
 {
     mpir.mpfr_add_q(this, this, x, (int)roundingMode.GetValueOrDefault(DefaultRoundingMode));
     return(this);
 }
Beispiel #25
0
 public int CompareTo(mpq other)
 {
     return(Math.Sign(mpir.mpq_cmp(this, other)));
 }
Beispiel #26
0
 public xmpq(mpq op) : base(op)
 {
 }
Beispiel #27
0
 public static int Compare(uint x, mpq y)
 {
     return(-y.CompareTo(x));
 }
Beispiel #28
0
 public override mpq Add(mpq x)
 {
     mpir.mpq_add(this, this, x);
     return(this);
 }
Beispiel #29
0
 public static int Compare(double x, mpq y)
 {
     return(-y.CompareTo(x));
 }
Beispiel #30
0
 public mpc(mpq op, long?precision = null, RoundingMode?roundingMode = null) : this(precision : precision)
 {
     mpir.mpc_set_q(this, op, (int)roundingMode.GetValueOrDefault(DefaultRoundingMode));
 }