Floating point exponentiation

Chris Gast cmgast at gmail.com
Tue Mar 23 02:01:05 CET 2010


Hello,

I'm relatively new to this library, and have encountered a problem for which
the manual does not appear to provide a solution.

Is there a way to compute exp(x), where x is a "big" floating point
variable?

My code section is as follows:

    mpf_t expn;
    mpf_init(expn);
    mpf_set_d(expn,exp(1));

    mpf_t totLbig;
    mpf_init(totLbig);


I would then really like to just do the following:

mpf_pow_xyz(totLbig, expn, totLbig)

but it appears that my function mpf_pow_xyz truly is fictitious.

An alternative would be to approximate the value as totLbig =
(1+totLbig/n)^n, for a very large unsigned long integer n, but I'd like to
avoid this extra step, if possible.

Thanks in advance,

Chris Gast



-----------------------------
Chris Gast
cmgast at gmail.com


More information about the gmp-discuss mailing list