Ejemplo n.º 1
0
        public static MPFR operator /(uint lhs, MPFR rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_ui_div(result.Value, lhs, rhs.Value, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 2
0
        public static MPFR operator /(MPFR lhs, double rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_div_d(result.Value, lhs.Value, rhs, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 3
0
        public static MPFR Atan2(MPFR y, MPFR x)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_atan2(result.Value, y.Value, x.Value, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 4
0
        public static MPFR operator -(double lhs, MPFR rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_d_sub(result.Value, lhs, rhs.Value, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 5
0
        public static MPFR Cb(MPFR value)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_pow_ui(result.Value, value.Value, 3U, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 6
0
        public static MPFR Trunc(MPFR value)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_trunc(result.Value, value.Value);
            return(result);
        }
Ejemplo n.º 7
0
        public static MPFR operator *(int lhs, MPFR rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_mul_si(result.Value, rhs.Value, lhs, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 8
0
        public static MPFR operator +(MPFR value)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_abs(result.Value, value.Value, MPFR.RoundingMode);
            return(value);
        }
Ejemplo n.º 9
0
        public static MPFR operator +(MPFR lhs, uint rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_add_ui(result.Value, lhs.Value, rhs, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 10
0
        public static MPFR operator +(mpfr_t lhs, MPFR rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_add(result.Value, lhs, rhs.Value, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 11
0
        public static MPFR Exp10(MPFR value)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_exp10(result.Value, value.Value, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 12
0
        public static MPFR operator %(MPFR lhs, mpfr_t rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_fmod(result.Value, lhs.Value, rhs, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 13
0
        public static MPFR Pow(MPFR a, MPFR b)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_pow(result.Value, a.Value, b.Value, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 14
0
        public static MPFR TruncatedDivision(uint lhs, MPFR rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_ui_div(result.Value, lhs, rhs.Value, MPFR.RoundingMode);
            mpfr_lib.mpfr_trunc(result.Value, result.Value);
            return(result);
        }
Ejemplo n.º 15
0
        public static MPFR TruncatedDivision(MPFR lhs, double rhs)
        {
            MPFR result = new MPFR();

            mpfr_lib.mpfr_div_d(result.Value, lhs.Value, rhs, MPFR.RoundingMode);
            mpfr_lib.mpfr_trunc(result.Value, result.Value);
            return(result);
        }
Ejemplo n.º 16
0
        public static MPFR Neg2(MPFR value)
        {
            if (value <= 0)
            {
                return(new MPFR(value));
            }

            return(Neg(value));
        }
Ejemplo n.º 17
0
        public static MPFR Mean(params MPFR[] values)
        {
            MPFR result = new MPFR(0);

            foreach (var value in values)
            {
                mpfr_lib.mpfr_add(result.Value, result.Value, value.Value, MPFR.RoundingMode);
            }

            mpfr_lib.mpfr_div_si(result.Value, result.Value, values.Length, MPFR.RoundingMode);
            return(result);
        }
Ejemplo n.º 18
0
        public static MPFR operator %(uint lhs, MPFR rhs)
        {
            MPFR result = new MPFR();

            mpfr_t tmpValue = new mpfr_t();

            mpfr_lib.mpfr_init_set_ui(tmpValue, lhs, MPFR.RoundingMode);

            mpfr_lib.mpfr_fmod(result.Value, rhs.Value, tmpValue, MPFR.RoundingMode);

            mpfr_lib.mpfr_clear(tmpValue);
            return(result);
        }
Ejemplo n.º 19
0
        public static MPFR Root(MPFR a, MPFR b)
        {
            MPFR result = new MPFR();

            mpfr_t tmpValue = new mpfr_t();

            mpfr_lib.mpfr_init(tmpValue);

            mpfr_lib.mpfr_si_div(tmpValue, 1, b.Value, MPFR.RoundingMode);
            mpfr_lib.mpfr_pow(result.Value, a.Value, tmpValue, MPFR.RoundingMode);

            mpfr_lib.mpfr_clear(tmpValue);
            return(result);
        }
Ejemplo n.º 20
0
        public static MPFR Asec(MPFR value)
        {
            MPFR result = new MPFR();

            mpfr_t tmpValue = new mpfr_t();

            mpfr_lib.mpfr_init(tmpValue);

            mpfr_lib.mpfr_si_div(tmpValue, 1, value.Value, MPFR.RoundingMode);
            mpfr_lib.mpfr_acos(result.Value, tmpValue, MPFR.RoundingMode);

            mpfr_lib.mpfr_clear(tmpValue);
            return(result);
        }
Ejemplo n.º 21
0
        public static MPFR URandom(mpfr_rnd_t roundingMode, bool inclusive = false)
        {
            MPFR result = new MPFR();

            if (inclusive)
            {
                mpfr_lib.mpfr_urandom(result.Value, MPFR.RandomState.Value, roundingMode);
            }
            else
            {
                mpfr_lib.mpfr_urandomb(result.Value, MPFR.RandomState.Value);
            }

            return(result);
        }
Ejemplo n.º 22
0
        public static MPFR LogN(MPFR x, MPFR n)
        {
            MPFR result = new MPFR();

            mpfr_t tmpX = new mpfr_t();
            mpfr_t tmpN = new mpfr_t();

            mpfr_lib.mpfr_inits(tmpX, tmpN);

            mpfr_lib.mpfr_log(tmpX, x.Value, MPFR.RoundingMode);
            mpfr_lib.mpfr_log(tmpN, n.Value, MPFR.RoundingMode);
            mpfr_lib.mpfr_div(result.Value, x, n, MPFR.RoundingMode);

            mpfr_lib.mpfr_clears(tmpX, tmpN);
            return(result);
        }
Ejemplo n.º 23
0
        public static MPFR Max(params MPFR[] values)
        {
            if (values.Length == 0)
            {
                return(new MPFR(MPFR.NaN));
            }

            MPFR result = values[0];

            for (int i = 1; i < values.Length; i++)
            {
                if (values[i] > result)
                {
                    result = values[i];
                }
            }

            return(new MPFR(result));
        }
Ejemplo n.º 24
0
        public static MPFR URandom(MPFR min, MPFR max, mpfr_rnd_t roundingMode, bool inclusive = false)
        {
            MPFR   result = new MPFR();
            mpfr_t tmp    = new mpfr_t();

            mpfr_lib.mpfr_init(tmp);

            if (inclusive)
            {
                mpfr_lib.mpfr_urandom(result.Value, MPFR.RandomState.Value, roundingMode);
            }
            else
            {
                mpfr_lib.mpfr_urandomb(result.Value, MPFR.RandomState.Value);
            }

            mpfr_lib.mpfr_sub(tmp, max.Value, min.Value, MPFR.RoundingMode);

            mpfr_lib.mpfr_mul(result.Value, result.Value, tmp, MPFR.RoundingMode);
            mpfr_lib.mpfr_add(result.Value, result.Value, min.Value, MPFR.RoundingMode);

            mpfr_lib.mpfr_clear(tmp);
            return(result);
        }
Ejemplo n.º 25
0
 public static MPFR URandom(MPFR min, MPFR max, bool inclusive = false)
 {
     return(MPFR.URandom(min, max, MPFR.RoundingMode, inclusive));
 }