diff options
Diffstat (limited to 'set_q.c')
-rw-r--r-- | set_q.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -42,22 +42,24 @@ mpfr_set_q (f, q, rnd) mpfr_t n,d; MPFR_CLEAR_FLAGS(f); - num = mpq_numref(q); - sign = mpz_cmp_ui(num, 0); - if (sign==0) { - MPFR_SET_ZERO(f); - return; - } + num = mpq_numref (q); + sign = mpz_cmp_ui (num, 0); + if (sign == 0) + { + MPFR_SET_ZERO(f); + return; + } den = mpq_denref(q); prec = MPFR_PREC(f); - mpfr_init2(n, mpz_sizeinbase(num, 2)); - mpfr_set_z(n, num, GMP_RNDZ); /* result is exact */ + mpfr_init2 (n, mpz_sizeinbase(num, 2)); + mpfr_set_z (n, num, GMP_RNDZ); /* result is exact */ mpfr_init2(d, mpz_sizeinbase(den, 2)); mpfr_set_z(d, den, GMP_RNDZ); /* result is exact */ - MPFR_PREC(f) = prec; + MPFR_PREC(f) = prec; mpfr_div(f, n, d, rnd); - mpfr_clear(n); mpfr_clear(d); + mpfr_clear(n); + mpfr_clear(d); } |