On 5/12/2011 2:13 PM, Bill Hart wrote:
There might be a way. But it would be in the mpfr documentation.

There should be no problems with either MPIR or MPFR on Windows.

Bill.

On 12 May 2011 19:00, Bob Smith<bsm...@sudleyplace.com>  wrote:
I need this function to extend mpz_fac_ui to non-integral arguments.  I see
it's in the MPFR library.  If I calculate in that library, is there a direct
way to convert the result to mpf format?

Or should I solve this problem entirely differently?

My code needs to run on both Windows and Linux platforms.

I see that the MPFR docs describe how to use mpf code with mpfr, but I'm working in the opposite direction: how to use an mpfr result with mpf.

Looking at the two structs:  __mpf_struct and __mpfr_struct

typedef struct
{
  int _mp_prec;         /* Max precision, in number of `mp_limb_t's.
                   Set by mpf_init and modified by
                   mpf_set_prec.  The area pointed to by the
                   _mp_d field contains `prec' + 1 limbs.  */
  int _mp_size;         /* abs(_mp_size) is the number of limbs the
                   last field points to.  If _mp_size is
                   negative this is a negative number.  */
  mp_exp_t _mp_exp;     /* Exponent, in the base of `mp_limb_t'.  */
  mp_limb_t *_mp_d;     /* Pointer to the limbs.  */
} __mpf_struct;

typedef struct {
  mpfr_prec_t  _mpfr_prec;
  mpfr_sign_t  _mpfr_sign;
  mpfr_exp_t   _mpfr_exp;
  mp_limb_t   *_mpfr_d;
} __mpfr_struct;

is the correspondence as simple as

mpfr_t mpfrVal;
mpf_t  mpfVal;

mpfVal->_mp_prec = mpfrVal->_mpfr_prec;
mpfVal->_mp_size = mpfrVal->_mpfr_sign ? -mpfrVal->_mpfr_prec
                                       :  mpfrVal->_mpfr_prec;
mpfVal->_mp_exp  = mpfrVal->_mp_exp;
mpfVal->_mp_d    = mpfrVal->_mp_d;

assuming both numbers have the same # bits per limb?

--
_______________________________________________________________
Bob Smith - bsm...@sudleyplace.com
http://www.sudleyplace.com - http://www.nars2000.org

--
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-devel@googlegroups.com.
To unsubscribe from this group, send email to 
mpir-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to