@@ -122,10 +122,17 @@ tape( 'the function returns `-135.0` if provided `x = y = -infinity`', opts, fun
122
122
t . end ( ) ;
123
123
} ) ;
124
124
125
- tape ( 'the function returns `0.0` when `x = +infinity`' , opts , function test ( t ) {
126
- t . equal ( atan2d ( - 2.0 , PINF ) , 0.0 , 'returns expected value' ) ;
127
- t . equal ( atan2d ( 0.0 , PINF ) , 0.0 , 'returns expected value' ) ;
128
- t . equal ( atan2d ( 2.0 , PINF ) , 0.0 , 'returns expected value' ) ;
125
+ tape ( 'the function returns `0.0` when `y > 0` and `x = +infinity`' , opts , function test ( t ) {
126
+ t . equal ( isPositiveZero ( atan2d ( 1.0 , PINF ) ) , true , 'returns expected value' ) ;
127
+ t . equal ( isPositiveZero ( atan2d ( 2.0 , PINF ) ) , true , 'returns expected value' ) ;
128
+ t . equal ( isPositiveZero ( atan2d ( 3.0 , PINF ) ) , true , 'returns expected value' ) ;
129
+ t . end ( ) ;
130
+ } ) ;
131
+
132
+ tape ( 'the function returns `-0.0` when `y < 0` and `x = +infinity`' , opts , function test ( t ) {
133
+ t . equal ( isNegativeZero ( atan2d ( - 1.0 , PINF ) ) , true , 'returns expected value' ) ;
134
+ t . equal ( isNegativeZero ( atan2d ( - 2.0 , PINF ) ) , true , 'returns expected value' ) ;
135
+ t . equal ( isNegativeZero ( atan2d ( - 3.0 , PINF ) ) , true , 'returns expected value' ) ;
129
136
t . end ( ) ;
130
137
} ) ;
131
138
@@ -164,13 +171,27 @@ tape( 'the function returns `90.0` if provided a positive `y` and `x=0`', opts,
164
171
t . end ( ) ;
165
172
} ) ;
166
173
167
- tape ( 'the function returns `90.0` if provided a negative `y` and `x=0`' , opts , function test ( t ) {
174
+ tape ( 'the function returns `90.0` if provided a positive `y` and `x=-0`' , opts , function test ( t ) {
175
+ t . equal ( atan2d ( 2.0 , - 0.0 ) , 90.0 , 'returns expected value' ) ;
176
+ t . equal ( atan2d ( 1.0 , - 0.0 ) , 90.0 , 'returns expected value' ) ;
177
+ t . equal ( atan2d ( 0.5 , - 0.0 ) , 90.0 , 'returns expected value' ) ;
178
+ t . end ( ) ;
179
+ } ) ;
180
+
181
+ tape ( 'the function returns `-90.0` if provided a negative `y` and `x=0`' , opts , function test ( t ) {
168
182
t . equal ( atan2d ( - 2.0 , 0.0 ) , - 90.0 , 'returns expected value' ) ;
169
183
t . equal ( atan2d ( - 1.0 , 0.0 ) , - 90.0 , 'returns expected value' ) ;
170
184
t . equal ( atan2d ( - 0.5 , 0.0 ) , - 90.0 , 'returns expected value' ) ;
171
185
t . end ( ) ;
172
186
} ) ;
173
187
188
+ tape ( 'the function returns `-90.0` if provided a negative `y` and `x=-0`' , opts , function test ( t ) {
189
+ t . equal ( atan2d ( - 2.0 , - 0.0 ) , - 90.0 , 'returns expected value' ) ;
190
+ t . equal ( atan2d ( - 1.0 , - 0.0 ) , - 90.0 , 'returns expected value' ) ;
191
+ t . equal ( atan2d ( - 0.5 , - 0.0 ) , - 90.0 , 'returns expected value' ) ;
192
+ t . end ( ) ;
193
+ } ) ;
194
+
174
195
tape ( 'the function evaluates the `atan2d` function (when x and y are positive)' , opts , function test ( t ) {
175
196
var expected ;
176
197
var actual ;
0 commit comments