File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -109,13 +109,11 @@ func exp(x float64) float64 {
109
109
110
110
// special cases
111
111
switch {
112
- case IsNaN (x ) || IsInf ( x , 1 ) :
112
+ case IsNaN (x ):
113
113
return x
114
- case IsInf (x , - 1 ):
115
- return 0
116
- case x > Overflow :
114
+ case x > Overflow : // handles case where x is +∞
117
115
return Inf (1 )
118
- case x < Underflow :
116
+ case x < Underflow : // handles case where x is -∞
119
117
return 0
120
118
case - NearZero < x && x < NearZero :
121
119
return 1 + x
@@ -157,13 +155,11 @@ func exp2(x float64) float64 {
157
155
158
156
// special cases
159
157
switch {
160
- case IsNaN (x ) || IsInf ( x , 1 ) :
158
+ case IsNaN (x ):
161
159
return x
162
- case IsInf (x , - 1 ):
163
- return 0
164
- case x > Overflow :
160
+ case x > Overflow : // handles case where x is +∞
165
161
return Inf (1 )
166
- case x < Underflow :
162
+ case x < Underflow : // handles case where x is -∞
167
163
return 0
168
164
}
169
165
You can’t perform that action at this time.
0 commit comments