Skip to content

Commit 3a29e54

Browse files
committed
feat: add c implementation of pow
1 parent 1e0bc4a commit 3a29e54

File tree

5 files changed

+140
-119
lines changed

5 files changed

+140
-119
lines changed

lib/node_modules/@stdlib/math/base/special/pow/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ int main( void ) {
188188
double x;
189189
double out;
190190
int i;
191-
191+
192192
for ( i = 0; i < 100; i++ ) {
193-
b = round( randu()*10.0 );
194-
x = round( randu()*10.0 ) - 5.0;
195-
out = stdlib_base_pow ( b, x );
196-
printf( "pow(%lf, %lf) = %lf\n", b, x, v );
193+
b = ( ( (double)rand() / (double)RAND_MAX ) * 10.0 );
194+
x = ( ( (double)rand() / (double)RAND_MAX ) * 10.0 ) - 5.0;
195+
out = stdlib_base_pow( b, x );
196+
printf( "pow(%lf, %lf) = %lf\n", b, x, out );
197197
}
198198
}
199199
```

lib/node_modules/@stdlib/math/base/special/pow/examples/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#/
22
# @license Apache-2.0
33
#
4-
# Copyright (c) 2022 The Stdlib Authors.
4+
# Copyright (c) 2024 The Stdlib Authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/math/base/special/pow/examples/c/example.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
#include <stdio.h>
2222

2323
int main( void ) {
24+
double out;
2425
double b;
2526
double x;
26-
double out;
2727
int i;
28-
28+
2929
for ( i = 0; i < 100; i++ ) {
30-
b = round( randu()*10.0 );
31-
x = round( randu()*10.0 ) - 5.0;
32-
out = stdlib_base_pow ( b, x );
33-
printf( "pow(%lf, %lf) = %lf\n", b, x, v );
30+
b = ( ( (double)rand() / (double)RAND_MAX ) * 10.0 );
31+
x = ( ( (double)rand() / (double)RAND_MAX ) * 10.0 ) - 5.0;
32+
out = stdlib_base_pow( b, x );
33+
printf( "pow(%lf, %lf) = %lf\n", b, x, out );
3434
}
3535
}

lib/node_modules/@stdlib/math/base/special/pow/manifest.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@
4747
"@stdlib/number/float64/base/set-high-word",
4848
"@stdlib/number/float64/base/set-low-word",
4949
"@stdlib/math/base/special/ldexp",
50-
"@stdlib/contants/float64/ln-two",
50+
"@stdlib/constants/float64/ln-two",
5151
"@stdlib/constants/float64/exponent-bias",
5252
"@stdlib/constants/float64/high-word-significand-mask",
5353
"@stdlib/math/base/assert/is-nan",
5454
"@stdlib/math/base/assert/is-infinite",
5555
"@stdlib/math/base/assert/is-integer",
5656
"@stdlib/math/base/special/sqrt",
57-
"@stdlib/math/base/assert/to-words"
57+
"@stdlib/number/float64/base/to-words"
5858
]
5959
},
6060
{
@@ -78,14 +78,14 @@
7878
"@stdlib/number/float64/base/set-high-word",
7979
"@stdlib/number/float64/base/set-low-word",
8080
"@stdlib/math/base/special/ldexp",
81-
"@stdlib/contants/float64/ln-two",
81+
"@stdlib/constants/float64/ln-two",
8282
"@stdlib/constants/float64/exponent-bias",
8383
"@stdlib/constants/float64/high-word-significand-mask",
8484
"@stdlib/math/base/assert/is-nan",
8585
"@stdlib/math/base/assert/is-infinite",
8686
"@stdlib/math/base/assert/is-integer",
8787
"@stdlib/math/base/special/sqrt",
88-
"@stdlib/math/base/assert/to-words"
88+
"@stdlib/number/float64/base/to-words"
8989
]
9090
},
9191
{
@@ -109,14 +109,14 @@
109109
"@stdlib/number/float64/base/set-high-word",
110110
"@stdlib/number/float64/base/set-low-word",
111111
"@stdlib/math/base/special/ldexp",
112-
"@stdlib/contants/float64/ln-two",
112+
"@stdlib/constants/float64/ln-two",
113113
"@stdlib/constants/float64/exponent-bias",
114114
"@stdlib/constants/float64/high-word-significand-mask",
115115
"@stdlib/math/base/assert/is-nan",
116116
"@stdlib/math/base/assert/is-infinite",
117117
"@stdlib/math/base/assert/is-integer",
118118
"@stdlib/math/base/special/sqrt",
119-
"@stdlib/math/base/assert/to-words"
119+
"@stdlib/number/float64/base/to-words"
120120
]
121121
}
122122
]

0 commit comments

Comments
 (0)