manpagez: man pages & more
info gsl-ref
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.27 Power Function

The following functions are equivalent to the function gsl_pow_int (see section Small integer powers) with an error estimate. These functions are declared in the header file ‘gsl_sf_pow_int.h’.

Function: double gsl_sf_pow_int (double x, int n)
Function: int gsl_sf_pow_int_e (double x, int n, gsl_sf_result * result)

These routines compute the power x^n for integer n. The power is computed using the minimum number of multiplications. For example, x^8 is computed as ((x^2)^2)^2, requiring only 3 multiplications. For reasons of efficiency, these functions do not check for overflow or underflow conditions.

 
#include <gsl/gsl_sf_pow_int.h>
/* compute 3.0**12 */
double y = gsl_sf_pow_int(3.0, 12); 

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.