@@ -57,118 +57,139 @@ tape( 'main export is a function', opts, function test( t ) {
5757} ) ;
5858
5959tape ( 'the function has two parameters: a numerator and a denominator value' , opts , function test ( t ) {
60- t . equal ( atan2 . length , 2.0 , 'arity is 2 ' ) ;
60+ t . equal ( atan2 . length , 2.0 , 'returns expected value ' ) ;
6161 t . end ( ) ;
6262} ) ;
6363
6464tape ( 'the function returns `NaN` if provided `NaN` as either of the arguments' , opts , function test ( t ) {
65- t . equal ( isnan ( atan2 ( 2.0 , NaN ) ) , true , 'returns NaN ' ) ;
66- t . equal ( isnan ( atan2 ( NaN , 3.0 ) ) , true , 'returns NaN ' ) ;
65+ t . equal ( isnan ( atan2 ( 2.0 , NaN ) ) , true , 'returns expected value ' ) ;
66+ t . equal ( isnan ( atan2 ( NaN , 3.0 ) ) , true , 'returns expected value ' ) ;
6767 t . end ( ) ;
6868} ) ;
6969
7070tape ( 'the function returns `+0` if provided `y = +0.0` and `x >= 0`' , opts , function test ( t ) {
71- t . equal ( isPositiveZero ( atan2 ( + 0.0 , 0.0 ) ) , true , 'returns +0 ' ) ;
72- t . equal ( isPositiveZero ( atan2 ( + 0.0 , 2.0 ) ) , true , 'returns +0 ' ) ;
73- t . equal ( isPositiveZero ( atan2 ( + 0.0 , 4.0 ) ) , true , 'returns +0 ' ) ;
74- t . equal ( isPositiveZero ( atan2 ( + 0.0 , 5.0 ) ) , true , 'returns +0 ' ) ;
75- t . equal ( isPositiveZero ( atan2 ( + 0.0 , 10.0 ) ) , true , 'returns +0 ' ) ;
71+ t . equal ( isPositiveZero ( atan2 ( + 0.0 , 0.0 ) ) , true , 'returns expected value ' ) ;
72+ t . equal ( isPositiveZero ( atan2 ( + 0.0 , 2.0 ) ) , true , 'returns expected value ' ) ;
73+ t . equal ( isPositiveZero ( atan2 ( + 0.0 , 4.0 ) ) , true , 'returns expected value ' ) ;
74+ t . equal ( isPositiveZero ( atan2 ( + 0.0 , 5.0 ) ) , true , 'returns expected value ' ) ;
75+ t . equal ( isPositiveZero ( atan2 ( + 0.0 , 10.0 ) ) , true , 'returns expected value ' ) ;
7676 t . end ( ) ;
7777} ) ;
7878
7979tape ( 'the function returns `-0` if provided `y = -0.0` and `x >= 0`' , opts , function test ( t ) {
80- t . equal ( isNegativeZero ( atan2 ( - 0.0 , 0.0 ) ) , true , 'returns -0 ' ) ;
81- t . equal ( isNegativeZero ( atan2 ( - 0.0 , 2.0 ) ) , true , 'returns -0 ' ) ;
82- t . equal ( isNegativeZero ( atan2 ( - 0.0 , 4.0 ) ) , true , 'returns -0 ' ) ;
83- t . equal ( isNegativeZero ( atan2 ( - 0.0 , 5.0 ) ) , true , 'returns -0 ' ) ;
84- t . equal ( isNegativeZero ( atan2 ( - 0.0 , 10.0 ) ) , true , 'returns -0 ' ) ;
80+ t . equal ( isNegativeZero ( atan2 ( - 0.0 , 0.0 ) ) , true , 'returns expected value ' ) ;
81+ t . equal ( isNegativeZero ( atan2 ( - 0.0 , 2.0 ) ) , true , 'returns expected value ' ) ;
82+ t . equal ( isNegativeZero ( atan2 ( - 0.0 , 4.0 ) ) , true , 'returns expected value ' ) ;
83+ t . equal ( isNegativeZero ( atan2 ( - 0.0 , 5.0 ) ) , true , 'returns expected value ' ) ;
84+ t . equal ( isNegativeZero ( atan2 ( - 0.0 , 10.0 ) ) , true , 'returns expected value ' ) ;
8585 t . end ( ) ;
8686} ) ;
8787
8888tape ( 'the function returns `PI` if provided `y = +0.0` and `x <= -0.0`' , opts , function test ( t ) {
89- t . equal ( atan2 ( + 0.0 , - 0.0 ) , + PI , 'returns +PI ' ) ;
90- t . equal ( atan2 ( + 0.0 , - 2.0 ) , + PI , 'returns +PI ' ) ;
91- t . equal ( atan2 ( + 0.0 , - 4.0 ) , + PI , 'returns +PI ' ) ;
92- t . equal ( atan2 ( + 0.0 , - 5.0 ) , + PI , 'returns +PI ' ) ;
93- t . equal ( atan2 ( + 0.0 , - 10.0 ) , + PI , 'returns +PI ' ) ;
89+ t . equal ( atan2 ( + 0.0 , - 0.0 ) , + PI , 'returns expected value ' ) ;
90+ t . equal ( atan2 ( + 0.0 , - 2.0 ) , + PI , 'returns expected value ' ) ;
91+ t . equal ( atan2 ( + 0.0 , - 4.0 ) , + PI , 'returns expected value ' ) ;
92+ t . equal ( atan2 ( + 0.0 , - 5.0 ) , + PI , 'returns expected value ' ) ;
93+ t . equal ( atan2 ( + 0.0 , - 10.0 ) , + PI , 'returns expected value ' ) ;
9494 t . end ( ) ;
9595} ) ;
9696
9797tape ( 'the function returns `-PI` if provided `y = -0.0` and `x <= -0.0`' , opts , function test ( t ) {
98- t . equal ( atan2 ( - 0.0 , - 0.0 ) , - PI , 'returns -PI ' ) ;
99- t . equal ( atan2 ( - 0.0 , - 2.0 ) , - PI , 'returns -PI ' ) ;
100- t . equal ( atan2 ( - 0.0 , - 4.0 ) , - PI , 'returns -PI ' ) ;
101- t . equal ( atan2 ( - 0.0 , - 5.0 ) , - PI , 'returns -PI ' ) ;
102- t . equal ( atan2 ( - 0.0 , - 10.0 ) , - PI , 'returns -PI ' ) ;
98+ t . equal ( atan2 ( - 0.0 , - 0.0 ) , - PI , 'returns expected value ' ) ;
99+ t . equal ( atan2 ( - 0.0 , - 2.0 ) , - PI , 'returns expected value ' ) ;
100+ t . equal ( atan2 ( - 0.0 , - 4.0 ) , - PI , 'returns expected value ' ) ;
101+ t . equal ( atan2 ( - 0.0 , - 5.0 ) , - PI , 'returns expected value ' ) ;
102+ t . equal ( atan2 ( - 0.0 , - 10.0 ) , - PI , 'returns expected value ' ) ;
103103 t . end ( ) ;
104104} ) ;
105105
106106tape ( 'the function returns `+PI/4` if provided `x = y = +infinity`' , opts , function test ( t ) {
107- t . equal ( atan2 ( PINF , PINF ) , + PI / 4.0 , 'returns +PI/4 ' ) ;
107+ t . equal ( atan2 ( PINF , PINF ) , + PI / 4.0 , 'returns expected value ' ) ;
108108 t . end ( ) ;
109109} ) ;
110110
111111tape ( 'the function returns `-PI/4` if provided `x = -y = +infinity`' , opts , function test ( t ) {
112- t . equal ( atan2 ( NINF , PINF ) , - PI / 4.0 , 'returns -PI/4 ' ) ;
112+ t . equal ( atan2 ( NINF , PINF ) , - PI / 4.0 , 'returns expected value ' ) ;
113113 t . end ( ) ;
114114} ) ;
115115
116116tape ( 'the function returns `*3*PI/4` if provided `-x = y = +infinity`' , opts , function test ( t ) {
117- t . equal ( atan2 ( PINF , NINF ) , + 3.0 * PI / 4.0 , 'returns +3*PI/4 ' ) ;
117+ t . equal ( atan2 ( PINF , NINF ) , + 3.0 * PI / 4.0 , 'returns expected value ' ) ;
118118 t . end ( ) ;
119119} ) ;
120120
121121tape ( 'the function returns `-3*PI/4` if provided `x = y = -infinity`' , opts , function test ( t ) {
122- t . equal ( atan2 ( NINF , NINF ) , - 3.0 * PI / 4.0 , 'returns -3*PI/4 ' ) ;
122+ t . equal ( atan2 ( NINF , NINF ) , - 3.0 * PI / 4.0 , 'returns expected value ' ) ;
123123 t . end ( ) ;
124124} ) ;
125125
126- tape ( 'the function returns `0.0` when `x = +infinity`' , opts , function test ( t ) {
127- t . equal ( atan2 ( - 2.0 , PINF ) , 0.0 , 'returns 0.0' ) ;
128- t . equal ( atan2 ( 0.0 , PINF ) , 0.0 , 'returns 0.0' ) ;
129- t . equal ( atan2 ( 2.0 , PINF ) , 0.0 , 'returns 0.0' ) ;
126+ tape ( 'the function returns `0.0` when `y > 0` and `x = +infinity`' , opts , function test ( t ) {
127+ t . equal ( isPositiveZero ( atan2 ( 1.0 , PINF ) ) , true , 'returns expected value' ) ;
128+ t . equal ( isPositiveZero ( atan2 ( 2.0 , PINF ) ) , true , 'returns expected value' ) ;
129+ t . equal ( isPositiveZero ( atan2 ( 3.0 , PINF ) ) , true , 'returns expected value' ) ;
130+ t . end ( ) ;
131+ } ) ;
132+
133+ tape ( 'the function returns `-0.0` when `y < 0` and `x = +infinity`' , opts , function test ( t ) {
134+ t . equal ( isNegativeZero ( atan2 ( - 1.0 , PINF ) ) , true , 'returns expected value' ) ;
135+ t . equal ( isNegativeZero ( atan2 ( - 2.0 , PINF ) ) , true , 'returns expected value' ) ;
136+ t . equal ( isNegativeZero ( atan2 ( - 3.0 , PINF ) ) , true , 'returns expected value' ) ;
130137 t . end ( ) ;
131138} ) ;
132139
133140tape ( 'the function returns `+PI` when `y > 0` and `x = -infinity`' , opts , function test ( t ) {
134- t . equal ( atan2 ( 1.0 , NINF ) , PI , 'returns PI ' ) ;
135- t . equal ( atan2 ( 2.0 , NINF ) , PI , 'returns PI ' ) ;
136- t . equal ( atan2 ( 3.0 , NINF ) , PI , 'returns PI ' ) ;
141+ t . equal ( atan2 ( 1.0 , NINF ) , PI , 'returns expected value ' ) ;
142+ t . equal ( atan2 ( 2.0 , NINF ) , PI , 'returns expected value ' ) ;
143+ t . equal ( atan2 ( 3.0 , NINF ) , PI , 'returns expected value ' ) ;
137144 t . end ( ) ;
138145} ) ;
139146
140147tape ( 'the function returns `-PI` when `y < 0` and `x = -infinity`' , opts , function test ( t ) {
141- t . equal ( atan2 ( - 1.0 , NINF ) , - PI , 'returns -PI ' ) ;
142- t . equal ( atan2 ( - 2.0 , NINF ) , - PI , 'returns -PI ' ) ;
143- t . equal ( atan2 ( - 3.0 , NINF ) , - PI , 'returns -PI ' ) ;
148+ t . equal ( atan2 ( - 1.0 , NINF ) , - PI , 'returns expected value ' ) ;
149+ t . equal ( atan2 ( - 2.0 , NINF ) , - PI , 'returns expected value ' ) ;
150+ t . equal ( atan2 ( - 3.0 , NINF ) , - PI , 'returns expected value ' ) ;
144151 t . end ( ) ;
145152} ) ;
146153
147154tape ( 'the function returns `+PI/2` when `y = +infinity`' , opts , function test ( t ) {
148- t . equal ( atan2 ( PINF , - 1.0 ) , PI / 2.0 , 'returns PI/2 ' ) ;
149- t . equal ( atan2 ( PINF , 0.0 ) , PI / 2.0 , 'returns PI/2 ' ) ;
150- t . equal ( atan2 ( PINF , 2.0 ) , PI / 2.0 , 'returns PI/2 ' ) ;
155+ t . equal ( atan2 ( PINF , - 1.0 ) , PI / 2.0 , 'returns expected value ' ) ;
156+ t . equal ( atan2 ( PINF , 0.0 ) , PI / 2.0 , 'returns expected value ' ) ;
157+ t . equal ( atan2 ( PINF , 2.0 ) , PI / 2.0 , 'returns expected value ' ) ;
151158 t . end ( ) ;
152159} ) ;
153160
154161tape ( 'the function returns `-PI/2` when `y = -infinity`' , opts , function test ( t ) {
155- t . equal ( atan2 ( NINF , - 1.0 ) , - PI / 2.0 , 'returns -PI/2 ' ) ;
156- t . equal ( atan2 ( NINF , 0.0 ) , - PI / 2.0 , 'returns -PI/2 ' ) ;
157- t . equal ( atan2 ( NINF , 2.0 ) , - PI / 2.0 , 'returns -PI/2 ' ) ;
162+ t . equal ( atan2 ( NINF , - 1.0 ) , - PI / 2.0 , 'returns expected value ' ) ;
163+ t . equal ( atan2 ( NINF , 0.0 ) , - PI / 2.0 , 'returns expected value ' ) ;
164+ t . equal ( atan2 ( NINF , 2.0 ) , - PI / 2.0 , 'returns expected value ' ) ;
158165 t . end ( ) ;
159166} ) ;
160167
161168tape ( 'the function returns `PI/2` if provided a positive `y` and `x=0`' , opts , function test ( t ) {
162- t . equal ( atan2 ( 2.0 , 0.0 ) , PI / 2.0 , 'returns PI/2' ) ;
163- t . equal ( atan2 ( 1.0 , 0.0 ) , PI / 2.0 , 'returns PI/2' ) ;
164- t . equal ( atan2 ( 0.5 , 0.0 ) , PI / 2.0 , 'returns PI/2' ) ;
169+ t . equal ( atan2 ( 2.0 , 0.0 ) , PI / 2.0 , 'returns expected value' ) ;
170+ t . equal ( atan2 ( 1.0 , 0.0 ) , PI / 2.0 , 'returns expected value' ) ;
171+ t . equal ( atan2 ( 0.5 , 0.0 ) , PI / 2.0 , 'returns expected value' ) ;
172+ t . end ( ) ;
173+ } ) ;
174+
175+ tape ( 'the function returns `PI/2` if provided a positive `y` and `x=-0`' , opts , function test ( t ) {
176+ t . equal ( atan2 ( 2.0 , - 0.0 ) , PI / 2.0 , 'returns expected value' ) ;
177+ t . equal ( atan2 ( 1.0 , - 0.0 ) , PI / 2.0 , 'returns expected value' ) ;
178+ t . equal ( atan2 ( 0.5 , - 0.0 ) , PI / 2.0 , 'returns expected value' ) ;
165179 t . end ( ) ;
166180} ) ;
167181
168182tape ( 'the function returns `-PI/2` if provided a negative `y` and `x=0`' , opts , function test ( t ) {
169- t . equal ( atan2 ( - 2.0 , 0.0 ) , - PI / 2.0 , 'returns PI/2' ) ;
170- t . equal ( atan2 ( - 1.0 , 0.0 ) , - PI / 2.0 , 'returns PI/2' ) ;
171- t . equal ( atan2 ( - 0.5 , 0.0 ) , - PI / 2.0 , 'returns PI/2' ) ;
183+ t . equal ( atan2 ( - 2.0 , 0.0 ) , - PI / 2.0 , 'returns expected value' ) ;
184+ t . equal ( atan2 ( - 1.0 , 0.0 ) , - PI / 2.0 , 'returns expected value' ) ;
185+ t . equal ( atan2 ( - 0.5 , 0.0 ) , - PI / 2.0 , 'returns expected value' ) ;
186+ t . end ( ) ;
187+ } ) ;
188+
189+ tape ( 'the function returns `-PI/2` if provided a negative `y` and `x=-0`' , opts , function test ( t ) {
190+ t . equal ( atan2 ( - 2.0 , - 0.0 ) , - PI / 2.0 , 'returns expected value' ) ;
191+ t . equal ( atan2 ( - 1.0 , - 0.0 ) , - PI / 2.0 , 'returns expected value' ) ;
192+ t . equal ( atan2 ( - 0.5 , - 0.0 ) , - PI / 2.0 , 'returns expected value' ) ;
172193 t . end ( ) ;
173194} ) ;
174195
0 commit comments