diff options
author | Kevin Ryde <user42@zip.com.au> | 2003-07-24 00:52:44 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2003-07-24 00:52:44 +0200 |
commit | cdb026a713ddc9be710a089225a5c3305d751d72 (patch) | |
tree | c24eb4c794c46e44a03ed5527e635c9514b5ed89 /gmpxx.h | |
parent | c2ceee3783fe6cde592911a410bd074b096fbffa (diff) | |
download | gmp-cdb026a713ddc9be710a089225a5c3305d751d72.tar.gz |
* gmpxx.h (struct __gmp_hypot_function): Use mpfr_hypot.
Diffstat (limited to 'gmpxx.h')
-rw-r--r-- | gmpxx.h | 64 |
1 files changed, 19 insertions, 45 deletions
@@ -1916,80 +1916,54 @@ struct __gmp_hypot_function #ifdef __MPFR_H static void eval(mpfr_ptr f, mpfr_srcptr g, mpfr_srcptr h) - { - mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_mul(f, h, h, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); - mpfr_clear(temp); - } + { mpfr_hypot (f, g, h, __gmp_default_rounding_mode); } static void eval(mpfr_ptr f, mpfr_srcptr g, unsigned long int l) { mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_set_ui(f, l, __gmp_default_rounding_mode); - mpfr_mul(f, f, f, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); + mpfr_init2 (temp, 8*sizeof(l)); + mpfr_set_ui (temp, l, GMP_RNDZ); /* no rounding */ + mpfr_hypot (f, g, temp, __gmp_default_rounding_mode); mpfr_clear(temp); } static void eval(mpfr_ptr f, unsigned long int l, mpfr_srcptr g) { mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_set_ui(f, l, __gmp_default_rounding_mode); - mpfr_mul(f, f, f, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); + mpfr_init2 (temp, 8*sizeof(l)); + mpfr_set_ui (temp, l, GMP_RNDZ); /* no rounding */ + mpfr_hypot (f, g, temp, __gmp_default_rounding_mode); mpfr_clear(temp); } static void eval(mpfr_ptr f, mpfr_srcptr g, signed long int l) { mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_set_si(f, l, __gmp_default_rounding_mode); - mpfr_mul(f, f, f, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); + mpfr_init2 (temp, 8*sizeof(l)); + mpfr_set_si (temp, l, GMP_RNDZ); /* no rounding */ + mpfr_hypot (f, g, temp, __gmp_default_rounding_mode); mpfr_clear(temp); } static void eval(mpfr_ptr f, signed long int l, mpfr_srcptr g) { mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_set_si(f, l, __gmp_default_rounding_mode); - mpfr_mul(f, f, f, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); + mpfr_init2 (temp, 8*sizeof(l)); + mpfr_set_si (temp, l, GMP_RNDZ); /* no rounding */ + mpfr_hypot (f, g, temp, __gmp_default_rounding_mode); mpfr_clear(temp); } static void eval(mpfr_ptr f, mpfr_srcptr g, double d) { mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_set_d(f, d, __gmp_default_rounding_mode); - mpfr_mul(f, f, f, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); + mpfr_init2 (temp, 8*sizeof(l)); + mpfr_set_d (temp, l, GMP_RNDZ); /* no rounding */ + mpfr_hypot (f, g, temp, __gmp_default_rounding_mode); mpfr_clear(temp); } static void eval(mpfr_ptr f, double d, mpfr_srcptr g) { mpfr_t temp; - mpfr_init2(temp, mpfr_get_prec(f)); - mpfr_mul(temp, g, g, __gmp_default_rounding_mode); - mpfr_set_d(f, d, __gmp_default_rounding_mode); - mpfr_mul(f, f, f, __gmp_default_rounding_mode); - mpfr_add(f, f, temp, __gmp_default_rounding_mode); - mpfr_sqrt(f, f, __gmp_default_rounding_mode); + mpfr_init2 (temp, 8*sizeof(l)); + mpfr_set_d (temp, l, GMP_RNDZ); /* no rounding */ + mpfr_hypot (f, g, temp, __gmp_default_rounding_mode); mpfr_clear(temp); } #endif |