Permalink
Browse files

dd wrapper

  • Loading branch information...
gilvillard committed Sep 27, 2017
1 parent cf2bbe4 commit e1030172685621ae4999759f718d1394701b2862
Showing with 23 additions and 5 deletions.
  1. +11 −2 fplll/nr/nr_FP_dd.inl
  2. +12 −3 fplll/nr/nr_FP_misc.inl
View
@@ -43,9 +43,18 @@ inline void FP_NR<dd_real>::get_mpfr(mpfr_t r, mp_rnd_t rnd) const {
mpfr_add_d (r, r, data._hi(), rnd);
}
template<>
template<>
inline void FP_NR<dd_real>::set_mpfr(mpfr_t r, mp_rnd_t rnd) {
data = mpfr_get_ld (r, rnd);
double hi;
hi = mpfr_get_d (r, rnd);
mpfr_t tf;
mpfr_init(tf);
mpfr_sub_d(tf,r,hi,rnd);
data = dd_real(hi,mpfr_get_d (tf, rnd));
}
template<>
View
@@ -113,10 +113,19 @@ inline void FP_NR<dd_real>::set_z(const Z_NR<double>& a, mp_rnd_t /*rnd*/) {
}
#endif
/** set_z (from default mpz_t to dd_real) */
/** set_z (from default mpz_t to dd_real) */
template<> template<>
inline void FP_NR<dd_real>::set_z(const Z_NR<mpz_t>& a, mp_rnd_t /*rnd*/) {
data = mpz_get_d(a.get_data());
double hi = mpz_get_d(a.get_data());
mpz_t tz;
mpz_init(tz);
mpz_set_d(tz,hi);
mpz_sub(tz,a.get_data(),tz);
data = dd_real(hi,mpz_get_d(tz));
}
#endif
@@ -395,4 +404,4 @@ inline void FP_NR<mpfr_t>::get_z_exp_we(Z_NR<Z>& a, long& expo, long /*expo_add*
FPLLL_END_NAMESPACE
#endif
#endif

0 comments on commit e103017

Please sign in to comment.