Skip to content

Commit 1eabfb2

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 25ef497 + 4975cf0 commit 1eabfb2

File tree

173 files changed

+247
-453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+247
-453
lines changed

lib/node_modules/@stdlib/math/base/special/kernel-log1p/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# kernelLog1p
2222

23-
> Compute `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
23+
> Evaluate a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
2424
2525
<section class="usage">
2626

@@ -32,7 +32,7 @@ var kernelLog1p = require( '@stdlib/math/base/special/kernel-log1p' );
3232

3333
#### kernelLog1p( f )
3434

35-
Computes `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
35+
Evaluates a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
3636

3737
```javascript
3838
var v = kernelLog1p( 1.0 );
@@ -111,7 +111,7 @@ logEachMap( 'kernelLog1p(%0.4f) = %0.4f', x, kernelLog1p );
111111

112112
#### stdlib_base_kernel_log1p( f )
113113

114-
Computes `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
114+
Evaluates a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
115115

116116
```c
117117
double out = stdlib_base_kernel_log1p( 1.0 );

lib/node_modules/@stdlib/math/base/special/kernel-log1p/benchmark/benchmark.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var FLOAT64_SQRT_HALF = require( '@stdlib/constants/float64/sqrt-half' );
27+
var FLOAT64_SQRT_TWO = require( '@stdlib/constants/float64/sqrt-two' );
2628
var pkg = require( './../package.json' ).name;
2729
var kernelLog1p = require( './../lib' );
2830

@@ -34,10 +36,11 @@ bench( pkg, function benchmark( b ) {
3436
var y;
3537
var i;
3638

39+
x = uniform( 100, FLOAT64_SQRT_HALF, FLOAT64_SQRT_TWO );
40+
3741
b.tic();
3842
for ( i = 0; i < b.iterations; i++ ) {
39-
x = ( randu() + 1.0 ) * 0.7071067811865476;
40-
y = kernelLog1p( x );
43+
y = kernelLog1p( x[ i%x.length ] );
4144
if ( isnan( y ) ) {
4245
b.fail( 'should not return NaN' );
4346
}

lib/node_modules/@stdlib/math/base/special/kernel-log1p/benchmark/benchmark.native.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var tryRequire = require( '@stdlib/utils/try-require' );
28+
var FLOAT64_SQRT_HALF = require( '@stdlib/constants/float64/sqrt-half' );
29+
var FLOAT64_SQRT_TWO = require( '@stdlib/constants/float64/sqrt-two' );
2830
var pkg = require( './../package.json' ).name;
2931

3032

@@ -43,10 +45,11 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4345
var y;
4446
var i;
4547

48+
x = uniform( 100, FLOAT64_SQRT_HALF, FLOAT64_SQRT_TWO );
49+
4650
b.tic();
4751
for ( i = 0; i < b.iterations; i++ ) {
48-
x = ( randu() + 1.0 ) * 0.7071067811865476;
49-
y = kernelLog1p( x );
52+
y = kernelLog1p( x[ i%x.length ] );
5053
if ( isnan( y ) ) {
5154
b.fail( 'should not return NaN' );
5255
}

lib/node_modules/@stdlib/math/base/special/kernel-log1p/benchmark/c/native/benchmark.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ static double tic( void ) {
7575
}
7676

7777
/**
78-
* Generates a random number on the interval [0,1).
78+
* Generates a random number on the interval [min,max).
7979
*
80-
* @return random number
80+
* @param min minimum value (inclusive)
81+
* @param max maximum value (exclusive)
82+
* @return random number
8183
*/
82-
static double rand_double( void ) {
83-
int r = rand();
84-
return (double)r / ( (double)RAND_MAX + 1.0 );
84+
static double random_uniform( const double min, const double max ) {
85+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
86+
return min + ( v*(max-min) );
8587
}
8688

8789
/**
@@ -91,15 +93,18 @@ static double rand_double( void ) {
9193
*/
9294
static double benchmark( void ) {
9395
double elapsed;
94-
double x;
96+
double x[100];
9597
double z;
9698
double t;
9799
int i;
98100

101+
for ( i = 0; i < 100; i++ ) {
102+
x[ i ] = random_uniform( 0.7071067811865476, 1.4142135623730951 ); // ~[sqrt(2)/2, sqrt(2)]
103+
}
104+
99105
t = tic();
100106
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( rand_double() + 1.0 ) * 0.7071067811865476;
102-
z = stdlib_base_kernel_log1p( x );
107+
z = stdlib_base_kernel_log1p( x[ i%100 ] );
103108
if ( z != z ) {
104109
printf( "should not return NaN\n" );
105110
break;
@@ -124,7 +129,7 @@ int main( void ) {
124129

125130
print_version();
126131
for ( i = 0; i < REPEATS; i++ ) {
127-
printf( "# c::%s\n", NAME );
132+
printf( "# c::native::%s\n", NAME );
128133
elapsed = benchmark();
129134
print_results( elapsed );
130135
printf( "ok %d benchmark finished\n", i+1 );

lib/node_modules/@stdlib/math/base/special/kernel-log1p/docs/repl.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
{{alias}}( f )
3-
Computes `log(1+f) - f` for `1+f` in ~[sqrt(2)/2, sqrt(2)].
3+
Evaluates a correction term for double-precision base-2 and base-10
4+
logarithms when `1+f` is in `[√2/2, √2]`.
45

56
This function provides a common means for computing logarithms in base e.
67
Argument reduction and adding the final term of the polynomial must be done

lib/node_modules/@stdlib/math/base/special/kernel-log1p/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// TypeScript Version: 4.1
2020

2121
/**
22-
* Computes `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
22+
* Evaluates a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
2323
*
2424
* ## Notes
2525
*

lib/node_modules/@stdlib/math/base/special/kernel-log1p/include/stdlib/math/base/special/kernel_log1p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929
#endif
3030

3131
/**
32-
* Computes `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
32+
* Evaluates a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
3333
*/
3434
double stdlib_base_kernel_log1p( const double f );
3535

lib/node_modules/@stdlib/math/base/special/kernel-log1p/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* Compute `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
22+
* Evaluate a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
2323
*
2424
* @module @stdlib/math/base/special/kernel-log1p
2525
*

lib/node_modules/@stdlib/math/base/special/kernel-log1p/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var polyvalQ = require( './polyval_q.js' );
4141
// MAIN //
4242

4343
/**
44-
* Computes `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
44+
* Evaluates a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
4545
*
4646
* ## Method
4747
*

lib/node_modules/@stdlib/math/base/special/kernel-log1p/lib/native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Computes `log(1+f) - f` for `1+f` in `~[sqrt(2)/2, sqrt(2)]`.
29+
* Evaluates a correction term for double-precision base-2 and base-10 logarithms when `1+f` is in `[√2/2, √2]`.
3030
*
3131
* @private
3232
* @param {number} f - input value

0 commit comments

Comments
 (0)