NCEPLIBS-g2c  1.7.0
int_power.c
Go to the documentation of this file.
1 
5 #include "grib2_int.h"
6 
17 double
18 int_power(double x, g2int y)
19 {
20  double value;
21 
22  if (y < 0)
23  {
24  y = -y;
25  x = 1.0 / x;
26  }
27  value = 1.0;
28 
29  while (y)
30  {
31  if (y & 1)
32  {
33  value *= x;
34  }
35  x = x * x;
36  y >>= 1;
37  }
38  return value;
39 }
int_power
double int_power(double x, g2int y)
Function similar to C pow() power function.
Definition: int_power.c:18
grib2_int.h
Header file with internal function prototypes NCEPLIBS-g2c library.
g2int
int64_t g2int
Long integer type.
Definition: grib2.h:28