File tree Expand file tree Collapse file tree 3 files changed +14
-20
lines changed
lib/node_modules/@stdlib/math/base/special/expf Expand file tree Collapse file tree 3 files changed +14
-20
lines changed Original file line number Diff line number Diff line change 1
1
2
2
{{alias}}( x )
3
-
4
- Evaluates the natural exponential function for
5
- a single-precision floating-point number.
3
+ Evaluates the natural exponential function for a single-precision
4
+ floating-point number.
6
5
7
6
Parameters
8
7
----------
17
16
Examples
18
17
--------
19
18
> var y = {{alias}}( 4.0 )
20
- ~54.598
19
+ ~54.5982
21
20
> y = {{alias}}( -9.0 )
22
21
~1.234e-4
23
22
> y = {{alias}}( 0.0 )
27
26
28
27
See Also
29
28
--------
30
-
Original file line number Diff line number Diff line change 1
1
/**
2
2
* @license Apache-2.0
3
3
*
4
- * Copyright (c) 2025 The Stdlib Authors.
4
+ * Copyright (c) 2022 The Stdlib Authors.
5
5
*
6
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
7
* you may not use this file except in compliance with the License.
17
17
*/
18
18
19
19
#include "stdlib/math/base/special/expf.h"
20
- #include <stdio.h>
21
20
#include <stdlib.h>
21
+ #include <stdio.h>
22
22
23
23
int main ( void ) {
24
- float x [ 100 ] ;
24
+ float x ;
25
25
float v ;
26
26
int i ;
27
27
28
28
for ( i = 0 ; i < 100 ; i ++ ) {
29
- x [ i ] = ( ( (float )rand () / (float )RAND_MAX ) * 100.0f );
30
- }
31
-
32
- for ( i = 0 ; i < 100 ; i ++ ) {
33
- v = stdlib_base_expf ( x [ i ] );
34
- printf ( "e^%f = %f\n" , x [ i ], v );
29
+ x = ( (float )rand () / (float )RAND_MAX ) * 100.0f ;
30
+ v = stdlib_base_expf ( x );
31
+ printf ( "e^%f = %f\n" , x , v );
35
32
}
36
33
}
Original file line number Diff line number Diff line change 19
19
'use strict' ;
20
20
21
21
var uniform = require ( '@stdlib/random/array/uniform' ) ;
22
+ var logEachMap = require ( '@stdlib/console/log-each-map' ) ;
22
23
var expf = require ( './../lib' ) ;
23
24
24
- var x = uniform ( 100 , - 50.0 , 50.0 , {
25
+ var opts = {
25
26
'dtype' : 'float32'
26
- } ) ;
27
+ } ;
28
+ var x = uniform ( 100 , - 50.0 , 50.0 , opts ) ;
27
29
28
- var i ;
29
- for ( i = 0 ; i < 100 ; i ++ ) {
30
- console . log ( 'e^%f = %f' , x , expf ( x [ i ] ) ) ;
31
- }
30
+ logEachMap ( 'e^%0.4f = %0.4f' , x , expf ) ;
You can’t perform that action at this time.
0 commit comments