Former-commit-id:5a0a40e67c
[formerlyf8f995b697
[formerly 0d10fff4b09db0e4b0b8bcf7481f5f13af0943f5]] Former-commit-id:f8f995b697
Former-commit-id:a32eadf384
30 lines
462 B
C
Executable file
30 lines
462 B
C
Executable file
#include "grib2.h"
|
|
/*
|
|
* w. ebisuzaki
|
|
*
|
|
* return x**y
|
|
*
|
|
*
|
|
* input: double x
|
|
* int y
|
|
*/
|
|
double int_power(double x, g2int y) {
|
|
|
|
double value;
|
|
|
|
if (y < 0) {
|
|
y = -y;
|
|
x = 1.0 / x;
|
|
}
|
|
value = 1.0;
|
|
|
|
while (y) {
|
|
if (y & 1) {
|
|
value *= x;
|
|
}
|
|
x = x * x;
|
|
y >>= 1;
|
|
}
|
|
return value;
|
|
}
|
|
|