Skip to content

Commit 7bcfb27

Browse files
feat: add math/base/special/expf
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent c877fc8 commit 7bcfb27

File tree

9 files changed

+24
-30
lines changed

9 files changed

+24
-30
lines changed

lib/node_modules/@stdlib/math/base/special/expf/benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
25-
var Float32Array = require( '@stdlib/array/float32' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2625
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2726
var pkg = require( './../package.json' ).name;
2827
var expf = require( './../lib' );
@@ -37,10 +36,9 @@ bench( pkg, function benchmark( b ) {
3736
var i;
3837

3938
len = 100;
40-
x = new Float32Array( len );
41-
for ( i = 0; i < len; i++ ) {
42-
x[ i ] = ( randu() * 100.0 ) - 50.0;
43-
}
39+
x = uniform( len, -50.0, 50.0, {
40+
'dtype': 'float32'
41+
});
4442

4543
b.tic();
4644
for ( i = 0; i < b.iterations; i++ ) {
@@ -64,10 +62,9 @@ bench( pkg+'::built-in', function benchmark( b ) {
6462
var i;
6563

6664
len = 100;
67-
x = new Float32Array( len );
68-
for ( i = 0; i < len; i++ ) {
69-
x[ i ] = ( randu() * 100.0 ) - 50.0;
70-
}
65+
x = uniform( len, -50.0, 50.0, {
66+
'dtype': 'float32'
67+
});
7168

7269
b.tic();
7370
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/math/base/special/expf/benchmark/benchmark.native.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var Float32Array = require( '@stdlib/array/float32' );
26-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2726
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2827
var tryRequire = require( '@stdlib/utils/try-require' );
2928
var pkg = require( './../package.json' ).name;
@@ -46,10 +45,9 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4645
var i;
4746

4847
len = 100;
49-
x = new Float32Array( len );
50-
for ( i = 0; i < len; i++ ) {
51-
x[ i ] = ( randu() * 100.0 ) - 50.0;
52-
}
48+
x = uniform( len, -50.0, 50.0, {
49+
'dtype': 'float32'
50+
});
5351

5452
b.tic();
5553
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/math/base/special/expf/benchmark/c/native/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ int main( void ) {
122122
double elapsed;
123123
int i;
124124

125-
// Use the current time to seed the random number generator:
125+
// Use the current time to seed the random number generator:
126126
srand( time( NULL ) );
127127

128128
print_version();
129129
for ( i = 0; i < REPEATS; i++ ) {
130130
printf( "# c::native::%s\n", NAME );
131131
elapsed = benchmark();
132132
print_results( elapsed );
133-
printf( "ok %d benchmark finished\n", i + 1 );
133+
printf( "ok %d benchmark finished\n", i+1 );
134134
}
135135
print_summary( REPEATS, REPEATS );
136136
}

lib/node_modules/@stdlib/math/base/special/expf/docs/repl.txt

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

22
{{alias}}( x )
3-
Evaluates the natural exponential function as
3+
4+
Evaluates the natural exponential function as
45
a single-precision floating-point number.
56

67
Parameters

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#/
22
# @license Apache-2.0
33
#
4-
# Copyright (c) 2025 The Stdlib Authors.
4+
# Copyright (c) 2022 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.
@@ -70,7 +70,7 @@ else
7070
endif
7171

7272
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73-
INCLUDE ?=
73+
INCLUDE ?=
7474

7575
# List of source files:
7676
SOURCE_FILES ?=

lib/node_modules/@stdlib/math/base/special/expf/examples/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121
var uniform = require( '@stdlib/random/array/uniform' );
2222
var expf = require( './../lib' );
2323

24-
var opts = {
24+
var x = uniform( 100, -50.0, 50.0, {
2525
'dtype': 'float32'
26-
};
26+
});
2727

28-
var x = uniform( 100, -50.0, 50.0, opts );
2928
var i;
30-
3129
for ( i = 0; i < 100; i++ ) {
3230
console.log( 'e^%f = %f', x, expf( x[ i ] ) );
3331
}

lib/node_modules/@stdlib/math/base/special/expf/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ float stdlib_base_expf( const float x ) {
212212
if ( x > NEG_NEARZERO && x < NEARZERO ) {
213213
return 1.0 + x;
214214
}
215-
// Reduce and compute `r = hi - lo` for extra precision...
215+
// Reduce and compute `r = hi - lo` for extra precision...
216216
k = stdlib_base_truncf( ( LOG2_E * x ) + half[ xsb ] );
217217
hi = x - ( k * LN2_HI );
218218
lo = k * LN2_LO;

lib/node_modules/@stdlib/math/base/special/expf/test/fixtures/julia/runner.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import JSON
2020

2121
"""
22-
gen( domain, filepath )
22+
gen( domain, filepath )
2323
2424
Generate fixture data and write to file.
2525

lib/node_modules/@stdlib/math/base/special/expf/test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,18 @@ tape( 'the function accurately computes the natural exponential function for ver
148148

149149
tape( 'the function returns `0` if provided a `-infinity`', function test( t ) {
150150
var val = expf( NINF );
151-
t.equal( val, 0.0, 'returns 0' );
151+
t.equal( val, 0.0, 'returns expected value' );
152152
t.end();
153153
});
154154

155155
tape( 'the function returns `+infinity` if provided a `+infinity`', function test( t ) {
156156
var val = expf( PINF );
157-
t.equal( val, PINF, 'returns +infinity' );
157+
t.equal( val, PINF, 'returns expected value' );
158158
t.end();
159159
});
160160

161161
tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) {
162162
var val = expf( NaN );
163-
t.equal( isnan( val ), true, 'returns NaN' );
163+
t.equal( isnan( val ), true, 'returns expected value' );
164164
t.end();
165165
});

0 commit comments

Comments
 (0)