mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
430 B
28 lines
430 B
4 years ago
|
#include "f2c.h"
|
||
|
|
||
|
double pow_di(double *ap, int *bp)
|
||
|
{
|
||
|
double p = 1;
|
||
|
double x = *ap;
|
||
|
int n = *bp;
|
||
|
|
||
|
if(n != 0)
|
||
|
{
|
||
|
if(n < 0)
|
||
|
{
|
||
|
n = -n;
|
||
|
x = 1/x;
|
||
|
}
|
||
|
unsigned u = (unsigned)n;
|
||
|
for(;;)
|
||
|
{
|
||
|
if((u & 1) != 0)
|
||
|
p *= x;
|
||
|
if((u >>= 1) == 0)
|
||
|
break;
|
||
|
x *= x;
|
||
|
}
|
||
|
}
|
||
|
return p;
|
||
|
}
|