1 /* LibTomFloat, multiple-precision floating-point library
3 * LibTomFloat is a library that provides multiple-precision
4 * floating-point artihmetic as well as trigonometric functionality.
6 * This library requires the public domain LibTomMath to be installed.
8 * This library is free for all purposes without any express
11 * Tom St Denis, tomstdenis@iahu.ca, http://float.libtomcrypt.org
15 /* we have e^x, so why not write a^b as e^(lna * b) ;-) w00t w00t */
16 int mpf_pow(mp_float
*a
, mp_float
*b
, mp_float
*c
)
21 if ((err
= mpf_init(&exponent
, c
->radix
)) != MP_OKAY
) {
26 if ((err
= mpf_ln(a
, &exponent
)) != MP_OKAY
) { goto __ERR
; }
28 /* multiply it by b */
29 if ((err
= mpf_mul(&exponent
, b
, &exponent
)) != MP_OKAY
) { goto __ERR
; }
32 err
= mpf_exp(&exponent
, c
);
34 __ERR
: mpf_clear(&exponent
);