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 11
22{{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.
65
76 Parameters
87 ----------
1716 Examples
1817 --------
1918 > var y = {{alias}}( 4.0 )
20- ~54.598
19+ ~54.5982
2120 > y = {{alias}}( -9.0 )
2221 ~1.234e-4
2322 > y = {{alias}}( 0.0 )
2726
2827 See Also
2928 --------
30-
Original file line number Diff line number Diff line change 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.
1717*/
1818
1919#include "stdlib/math/base/special/expf.h"
20- #include <stdio.h>
2120#include <stdlib.h>
21+ #include <stdio.h>
2222
2323int main ( void ) {
24- float x [ 100 ] ;
24+ float x ;
2525 float v ;
2626 int i ;
2727
2828 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 );
3532 }
3633}
Original file line number Diff line number Diff line change 1919'use strict' ;
2020
2121var uniform = require ( '@stdlib/random/array/uniform' ) ;
22+ var logEachMap = require ( '@stdlib/console/log-each-map' ) ;
2223var expf = require ( './../lib' ) ;
2324
24- var x = uniform ( 100 , - 50.0 , 50.0 , {
25+ var opts = {
2526 'dtype' : 'float32'
26- } ) ;
27+ } ;
28+ var x = uniform ( 100 , - 50.0 , 50.0 , opts ) ;
2729
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