Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ec1138e

Browse files
Add C++ implementation
Signed-off-by: begeekmyfriend <begeekmyfriend@gmail.com>
1 parent 425b077 commit ec1138e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

0050_pow/pow.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
#include <stdio.h>
33
#include <stdlib.h>
44

5-
static double fast_pow(double x, int n)
5+
6+
double fast_pow(double x, int n)
67
{
78
if (n == 0) { return 1.0; }
89
if (n == 1) { return x; }
910
double t = fast_pow(x, n / 2);
1011
return n & 1 ? t * t * x : t * t;
1112
}
1213

13-
static double my_pow(double x, int n)
14+
double my_pow(double x, int n)
1415
{
1516
if (n == INT_MIN) {
1617
double t = 1 / fast_pow(x, -(n / 2));

0 commit comments

Comments
 (0)