File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
lib/node_modules/@stdlib/math/base/special/exp2f Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ var polyvalQ = require( './polyval_q.js' );
74
74
*
75
75
* | arithmetic | domain | # trials | peak | rms |
76
76
* |:----------:|:-----------:|:--------:|:-------:|:-------:|
77
- * | IEEE | -127,+127 | 100000 | 1.7e-7 | 2.8e-8 |
77
+ * | IEEE | -127,+127 | 100000 | 1.7e-7 | 2.8e-8 |
78
78
*
79
79
* @param {number } x - input value
80
80
* @returns {number } function value
@@ -109,6 +109,10 @@ function exp2f( x ) {
109
109
return 0.0 ;
110
110
}
111
111
112
+ if ( x === 0.0 ) {
113
+ return 1.0 ;
114
+ }
115
+
112
116
// Separate into integer and fractional parts...
113
117
n = float64ToFloat32 ( roundf ( x ) ) ;
114
118
x -= float64ToFloat32 ( n ) ;
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ float stdlib_base_exp2f( const float x ) {
132
132
return 0.0f ;
133
133
}
134
134
135
+ // Range reduction
136
+ if ( x == 0.0f ) {
137
+ return 1.0f ;
138
+ }
139
+
135
140
// Separate into integer and fractional parts...
136
141
n = stdlib_base_roundf ( x );
137
142
ax = x - n ;
You can’t perform that action at this time.
0 commit comments