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