updated top-level README and version_decl for V4.4.2 (#1795)
[WRF.git] / external / io_grib1 / WGRIB / intpower.c
blob43112ed18d07e4b217cfc1a1c4d56ab5ce1a851d
1 #include <stdio.h>
2 #include <stdlib.h>
4 /*
5 * w. ebisuzaki
7 * return x**y
10 * input: double x
11 * int y
13 double int_power(double x, int y) {
15 double value;
17 if (y < 0) {
18 y = -y;
19 x = 1.0 / x;
21 value = 1.0;
23 while (y) {
24 if (y & 1) {
25 value *= x;
27 x = x * x;
28 y >>= 1;
30 return value;