<commit_before>#ifndef FPLLL_NR_FP_DD_H
#define FPLLL_NR_FP_DD_H
/**********************************
 *  F=dd_real specialization
 *********************************/

#include "../defs.h"
#include "nr_FP.inl"
#include <qd/dd_real.h>

FPLLL_BEGIN_NAMESPACE

/* DD specialization if defined QD */

/* constructor */
template<>
inline FP_NR<dd_real>::FP_NR() {}

template<>
inline FP_NR<dd_real>::FP_NR(const FP_NR<dd_real>& f) {data = f.data;}

template<>
inline FP_NR<dd_real>::~FP_NR() {}

template<>
inline unsigned int FP_NR<dd_real>::get_prec() {return PREC_DD;}

template<>
inline unsigned int FP_NR<dd_real>::set_prec(unsigned int) {
  return get_prec(); // ignored
}

/* return data */
template<>
inline double FP_NR<dd_real>::get_d(mp_rnd_t) const {
  return ::to_double(data);
}

template<>
inline void FP_NR<dd_real>::get_mpfr(mpfr_t r, mp_rnd_t rnd) const {
  mpfr_set_prec (r, get_prec());
  mpfr_set_d (r, data._lo(), rnd);
  mpfr_add_d (r, r, data._hi(), rnd);
}


template<> 
inline void FP_NR<dd_real>::set_mpfr(mpfr_t r, mp_rnd_t 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<>
inline long FP_NR<dd_real>::get_si() const {
  return to_int(data);
}

template<>
inline long FP_NR<dd_real>::exponent() const {
  return ilogb(::to_double(data)) + 1;
}

template<>
inline long FP_NR<dd_real>::get_si_exp_we(long& expo, long expo_add) const {
  if (data == 0)
    expo = 0;
  else
    expo = max(exponent() + expo_add - numeric_limits<long>::digits, 0L);
  return static_cast<long>((::ldexp(data, expo_add - expo)).x[0]);
}

template<>
inline long FP_NR<dd_real>::get_si_exp(long& expo) const {
  return get_si_exp_we(expo, 0);
}

/*  comparison */<commit_msg>Clear a mpfr.<commit_after>#ifndef FPLLL_NR_FP_DD_H
#define FPLLL_NR_FP_DD_H
/**********************************
 *  F=dd_real specialization
 *********************************/

#include "../defs.h"
#include "nr_FP.inl"
#include <qd/dd_real.h>

FPLLL_BEGIN_NAMESPACE

/* DD specialization if defined QD */

/* constructor */
template<>
inline FP_NR<dd_real>::FP_NR() {}

template<>
inline FP_NR<dd_real>::FP_NR(const FP_NR<dd_real>& f) {data = f.data;}

template<>
inline FP_NR<dd_real>::~FP_NR() {}

template<>
inline unsigned int FP_NR<dd_real>::get_prec() {return PREC_DD;}

template<>
inline unsigned int FP_NR<dd_real>::set_prec(unsigned int) {
  return get_prec(); // ignored
}

/* return data */
template<>
inline double FP_NR<dd_real>::get_d(mp_rnd_t) const {
  return ::to_double(data);
}

template<>
inline void FP_NR<dd_real>::get_mpfr(mpfr_t r, mp_rnd_t rnd) const {
  mpfr_set_prec (r, get_prec());
  mpfr_set_d (r, data._lo(), rnd);
  mpfr_add_d (r, r, data._hi(), rnd);
}


template<> 
inline void FP_NR<dd_real>::set_mpfr(mpfr_t r, mp_rnd_t 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));
  mpfr_clear(tf);
}

template<>
inline long FP_NR<dd_real>::get_si() const {
  return to_int(data);
}

template<>
inline long FP_NR<dd_real>::exponent() const {
  return ilogb(::to_double(data)) + 1;
}

template<>
inline long FP_NR<dd_real>::get_si_exp_we(long& expo, long expo_add) const {
  if (data == 0)
    expo = 0;
  else
    expo = max(exponent() + expo_add - numeric_limits<long>::digits, 0L);
  return static_cast<long>((::ldexp(data, expo_add - expo)).x[0]);
}

template<>
inline long FP_NR<dd_real>::get_si_exp(long& expo) const {
  return get_si_exp_we(expo, 0);
}

/*  comparison */
{'fraction_non_alphanumeric': 0.19444444444444445, 'fraction_numerical': 0.0033333333333333335, 'mean_word_length': 5.328646748681898, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6161592', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1494, 'n_words': 295}