Skip to content

Commit b652e36

Browse files
committed
Fudged version of atan2.t.
1 parent 06d8f11 commit b652e36

File tree

1 file changed

+75
-58
lines changed

1 file changed

+75
-58
lines changed

S32-trig/atan2.t

Lines changed: 75 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -87,181 +87,198 @@ is_approx(atan2(-4, -4), -3 * pi / 4, "atan2(-4, -4) is -3pi / 4");
8787

8888
{
8989
# Num tests
90-
is_approx(atan2((-0.1).Num), -0.099668652491162, "atan2(Num)");
90+
is_approx(atan2((-100).Num), -1.56079666010823, "atan2(Num)");
9191
}
9292

9393
{
9494
# Num vs Num tests
95-
is_approx((-0.1).Num.atan2((-0.1).Num), -2.35619449019234, "Num.atan2(Num)");
96-
is_approx(atan2((1).Num, (-10).Num), 3.04192400109863, "atan2(Num, Num)");
95+
is_approx((0.1).Num.atan2((-1).Num), 3.04192400109863, "Num.atan2(Num)");
96+
is_approx(atan2((10).Num, (1).Num), 1.47112767430373, "atan2(Num, Num)");
9797
}
9898

9999
{
100100
# Num vs Rat tests
101-
is_approx((-100).Num.atan2((100).Rat(1e-9)), -0.785398163397448, "Num.atan2(Rat)");
102-
is_approx(atan2((-1).Num, (0.1).Rat(1e-9)), -1.47112767430373, "atan2(Num, Rat)");
101+
is_approx((-10).Num.atan2((10).Rat(1e-9)), -0.785398163397448, "Num.atan2(Rat)");
102+
is_approx(atan2((-100).Num, (0.1).Rat(1e-9)), -1.56979632712823, "atan2(Num, Rat)");
103103
}
104104

105105
{
106106
# Num vs Int tests
107-
is_approx((-100).Num.atan2((-1).Int), -1.58079599348156, "Num.atan2(Int)");
108-
is_approx(atan2((100).Num, (-100).Int), 2.35619449019234, "atan2(Num, Int)");
107+
is_approx((-0.1).Num.atan2((-1).Int), -3.04192400109863, "Num.atan2(Int)");
108+
is_approx(atan2((0.1).Num, (-100).Int), 3.14059265392313, "atan2(Num, Int)");
109109
}
110110

111+
#?niecza skip 'Str math NYI'
111112
{
112113
# Num vs Str tests
113-
is_approx((100).Num.atan2((-0.1).Str), 1.57179632646156, "Num.atan2(Str)");
114-
is_approx(atan2((10).Num, (-100).Str), 3.04192400109863, "atan2(Num, Str)");
114+
is_approx((-100).Num.atan2((-1).Str), -1.58079599348156, "Num.atan2(Str)");
115+
is_approx(atan2((1).Num, (-100).Str), 3.13159298690313, "atan2(Num, Str)");
115116
}
116117

118+
#?niecza skip 'DifferentReal math NYI'
117119
{
118120
# Num vs DifferentReal tests
119-
is_approx((0.1).Num.atan2(DifferentReal.new(-0.1)), 2.35619449019234, "Num.atan2(DifferentReal)");
120-
is_approx(atan2((1).Num, DifferentReal.new(-0.1)), 1.67046497928606, "atan2(Num, DifferentReal)");
121+
is_approx((-10).Num.atan2(DifferentReal.new(-1)), -1.67046497928606, "Num.atan2(DifferentReal)");
122+
is_approx(atan2((-100).Num, DifferentReal.new(100)), -0.785398163397448, "atan2(Num, DifferentReal)");
121123
}
122124

123125
{
124126
# Rat tests
125-
is_approx((1).Rat(1e-9).atan2, 0.785398163397448, "Rat.atan2");
126-
is_approx(atan2((-0.1).Rat(1e-9)), -0.099668652491162, "atan2(Rat)");
127+
is_approx((-1).Rat(1e-9).atan2, -0.785398163397448, "Rat.atan2");
128+
is_approx(atan2((-1).Rat(1e-9)), -0.785398163397448, "atan2(Rat)");
127129
}
128130

129131
{
130132
# Rat vs Num tests
131-
is_approx((1).Rat(1e-9).atan2((0.1).Num), 1.47112767430373, "Rat.atan2(Num)");
132-
is_approx(atan2((0.1).Rat(1e-9), (-100).Num), 3.14059265392313, "atan2(Rat, Num)");
133+
is_approx((-100).Rat(1e-9).atan2((10).Num), -1.47112767430373, "Rat.atan2(Num)");
134+
is_approx(atan2((-100).Rat(1e-9), (-1).Num), -1.58079599348156, "atan2(Rat, Num)");
133135
}
134136

135137
{
136138
# Rat vs Rat tests
137-
is_approx((100).Rat(1e-9).atan2((100).Rat(1e-9)), 0.785398163397448, "Rat.atan2(Rat)");
138-
is_approx(atan2((-1).Rat(1e-9), (-0.1).Rat(1e-9)), -1.67046497928606, "atan2(Rat, Rat)");
139+
is_approx((-10).Rat(1e-9).atan2((-0.1).Rat(1e-9)), -1.58079599348156, "Rat.atan2(Rat)");
140+
is_approx(atan2((10).Rat(1e-9), (100).Rat(1e-9)), 0.099668652491162, "atan2(Rat, Rat)");
139141
}
140142

141143
{
142144
# Rat vs Int tests
143-
is_approx((-100).Rat(1e-9).atan2((10).Int), -1.47112767430373, "Rat.atan2(Int)");
144-
is_approx(atan2((-100).Rat(1e-9), (10).Int), -1.47112767430373, "atan2(Rat, Int)");
145+
is_approx((-100).Rat(1e-9).atan2((-1).Int), -1.58079599348156, "Rat.atan2(Int)");
146+
is_approx(atan2((-0.1).Rat(1e-9), (100).Int), -0.000999999666666867, "atan2(Rat, Int)");
145147
}
146148

149+
#?niecza skip 'Str math NYI'
147150
{
148151
# Rat vs Str tests
149-
is_approx((10).Rat(1e-9).atan2((1).Str), 1.47112767430373, "Rat.atan2(Str)");
150-
is_approx(atan2((-100).Rat(1e-9), (0.1).Str), -1.56979632712823, "atan2(Rat, Str)");
152+
is_approx((-100).Rat(1e-9).atan2((10).Str), -1.47112767430373, "Rat.atan2(Str)");
153+
is_approx(atan2((-10).Rat(1e-9), (10).Str), -0.785398163397448, "atan2(Rat, Str)");
151154
}
152155

156+
#?niecza skip 'DifferentReal math NYI'
153157
{
154158
# Rat vs DifferentReal tests
155-
is_approx((-10).Rat(1e-9).atan2(DifferentReal.new(-100)), -3.04192400109863, "Rat.atan2(DifferentReal)");
156-
is_approx(atan2((1).Rat(1e-9), DifferentReal.new(0.1)), 1.47112767430373, "atan2(Rat, DifferentReal)");
159+
is_approx((0.1).Rat(1e-9).atan2(DifferentReal.new(-10)), 3.13159298690313, "Rat.atan2(DifferentReal)");
160+
is_approx(atan2((-10).Rat(1e-9), DifferentReal.new(-0.1)), -1.58079599348156, "atan2(Rat, DifferentReal)");
157161
}
158162

159163
{
160164
# Int tests
161-
is_approx((100).Int.atan2, 1.56079666010823, "Int.atan2");
162-
is_approx(atan2((10).Int), 1.47112767430373, "atan2(Int)");
165+
is_approx((-100).Int.atan2, -1.56079666010823, "Int.atan2");
166+
is_approx(atan2((100).Int), 1.56079666010823, "atan2(Int)");
163167
}
164168

165169
{
166170
# Int vs Num tests
167-
is_approx((10).Int.atan2((1).Num), 1.47112767430373, "Int.atan2(Num)");
168-
is_approx(atan2((10).Int, (-1).Num), 1.67046497928606, "atan2(Int, Num)");
171+
is_approx((-10).Int.atan2((-100).Num), -3.04192400109863, "Int.atan2(Num)");
172+
is_approx(atan2((-100).Int, (100).Num), -0.785398163397448, "atan2(Int, Num)");
169173
}
170174

171175
{
172176
# Int vs Rat tests
173-
is_approx((10).Int.atan2((10).Rat(1e-9)), 0.785398163397448, "Int.atan2(Rat)");
174-
is_approx(atan2((-10).Int, (1).Rat(1e-9)), -1.47112767430373, "atan2(Int, Rat)");
177+
is_approx((1).Int.atan2((10).Rat(1e-9)), 0.099668652491162, "Int.atan2(Rat)");
178+
is_approx(atan2((100).Int, (1).Rat(1e-9)), 1.56079666010823, "atan2(Int, Rat)");
175179
}
176180

177181
{
178182
# Int vs Int tests
179-
is_approx((10).Int.atan2((-10).Int), 2.35619449019234, "Int.atan2(Int)");
183+
is_approx((100).Int.atan2((10).Int), 1.47112767430373, "Int.atan2(Int)");
180184
is_approx(atan2((1).Int, (-100).Int), 3.13159298690313, "atan2(Int, Int)");
181185
}
182186

187+
#?niecza skip 'Str math NYI'
183188
{
184189
# Int vs Str tests
185-
is_approx((-10).Int.atan2((100).Str), -0.099668652491162, "Int.atan2(Str)");
186-
is_approx(atan2((100).Int, (100).Str), 0.785398163397448, "atan2(Int, Str)");
190+
is_approx((-1).Int.atan2((100).Str), -0.00999966668666524, "Int.atan2(Str)");
191+
is_approx(atan2((100).Int, (0.1).Str), 1.56979632712823, "atan2(Int, Str)");
187192
}
188193

194+
#?niecza skip 'DifferentReal math NYI'
189195
{
190196
# Int vs DifferentReal tests
191-
is_approx((1).Int.atan2(DifferentReal.new(1)), 0.785398163397448, "Int.atan2(DifferentReal)");
192-
is_approx(atan2((-100).Int, DifferentReal.new(0.1)), -1.56979632712823, "atan2(Int, DifferentReal)");
197+
is_approx((1).Int.atan2(DifferentReal.new(-10)), 3.04192400109863, "Int.atan2(DifferentReal)");
198+
is_approx(atan2((-1).Int, DifferentReal.new(10)), -0.099668652491162, "atan2(Int, DifferentReal)");
193199
}
194200

195201
{
196202
# Str tests
197-
is_approx((100).Str.atan2, 1.56079666010823, "Str.atan2");
198-
is_approx(atan2((0.1).Str), 0.099668652491162, "atan2(Str)");
203+
is_approx((-100).Str.atan2, -1.56079666010823, "Str.atan2");
204+
is_approx(atan2((1).Str), 0.785398163397448, "atan2(Str)");
199205
}
200206

207+
#?niecza skip 'Str math NYI'
201208
{
202209
# Str vs Num tests
203-
is_approx((10).Str.atan2((1).Num), 1.47112767430373, "Str.atan2(Num)");
204-
is_approx(atan2((-100).Str, (1).Num), -1.56079666010823, "atan2(Str, Num)");
210+
is_approx((-100).Str.atan2((0.1).Num), -1.56979632712823, "Str.atan2(Num)");
211+
is_approx(atan2((-100).Str, (-1).Num), -1.58079599348156, "atan2(Str, Num)");
205212
}
206213

214+
#?niecza skip 'Str math NYI'
207215
{
208216
# Str vs Rat tests
209-
is_approx((-10).Str.atan2((-0.1).Rat(1e-9)), -1.58079599348156, "Str.atan2(Rat)");
210-
is_approx(atan2((100).Str, (1).Rat(1e-9)), 1.56079666010823, "atan2(Str, Rat)");
217+
is_approx((-1).Str.atan2((0.1).Rat(1e-9)), -1.47112767430373, "Str.atan2(Rat)");
218+
is_approx(atan2((-100).Str, (-10).Rat(1e-9)), -1.67046497928606, "atan2(Str, Rat)");
211219
}
212220

221+
#?niecza skip 'Str math NYI'
213222
{
214223
# Str vs Int tests
215-
is_approx((-0.1).Str.atan2((1).Int), -0.099668652491162, "Str.atan2(Int)");
216-
is_approx(atan2((-1).Str, (100).Int), -0.00999966668666524, "atan2(Str, Int)");
224+
is_approx((10).Str.atan2((-100).Int), 3.04192400109863, "Str.atan2(Int)");
225+
is_approx(atan2((-0.1).Str, (100).Int), -0.000999999666666867, "atan2(Str, Int)");
217226
}
218227

228+
#?niecza skip 'Str math NYI'
219229
{
220230
# Str vs Str tests
221-
is_approx((-1).Str.atan2((0.1).Str), -1.47112767430373, "Str.atan2(Str)");
222-
is_approx(atan2((0.1).Str, (-0.1).Str), 2.35619449019234, "atan2(Str, Str)");
231+
is_approx((100).Str.atan2((1).Str), 1.56079666010823, "Str.atan2(Str)");
232+
is_approx(atan2((10).Str, (-100).Str), 3.04192400109863, "atan2(Str, Str)");
223233
}
224234

235+
#?niecza skip 'Str math NYI'
225236
{
226237
# Str vs DifferentReal tests
227-
is_approx((-100).Str.atan2(DifferentReal.new(-10)), -1.67046497928606, "Str.atan2(DifferentReal)");
228-
is_approx(atan2((100).Str, DifferentReal.new(-10)), 1.67046497928606, "atan2(Str, DifferentReal)");
238+
is_approx((-1).Str.atan2(DifferentReal.new(-0.1)), -1.67046497928606, "Str.atan2(DifferentReal)");
239+
is_approx(atan2((-1).Str, DifferentReal.new(0.1)), -1.47112767430373, "atan2(Str, DifferentReal)");
229240
}
230241

242+
#?niecza skip 'DifferentReal math NYI'
231243
{
232244
# DifferentReal tests
233-
is_approx(DifferentReal.new(1).atan2, 0.785398163397448, "DifferentReal.atan2");
234-
is_approx(atan2(DifferentReal.new(-1)), -0.785398163397448, "atan2(DifferentReal)");
245+
is_approx(DifferentReal.new(0.1).atan2, 0.099668652491162, "DifferentReal.atan2");
246+
is_approx(atan2(DifferentReal.new(-10)), -1.47112767430373, "atan2(DifferentReal)");
235247
}
236248

249+
#?niecza skip 'DifferentReal math NYI'
237250
{
238251
# DifferentReal vs Num tests
239-
is_approx(DifferentReal.new(-1).atan2((0.1).Num), -1.47112767430373, "DifferentReal.atan2(Num)");
240-
is_approx(atan2(DifferentReal.new(-10), (100).Num), -0.099668652491162, "atan2(DifferentReal, Num)");
252+
is_approx(DifferentReal.new(-1).atan2((-100).Num), -3.13159298690313, "DifferentReal.atan2(Num)");
253+
is_approx(atan2(DifferentReal.new(10), (100).Num), 0.099668652491162, "atan2(DifferentReal, Num)");
241254
}
242255

256+
#?niecza skip 'DifferentReal math NYI'
243257
{
244258
# DifferentReal vs Rat tests
245-
is_approx(DifferentReal.new(-100).atan2((-10).Rat(1e-9)), -1.67046497928606, "DifferentReal.atan2(Rat)");
246-
is_approx(atan2(DifferentReal.new(-100), (1).Rat(1e-9)), -1.56079666010823, "atan2(DifferentReal, Rat)");
259+
is_approx(DifferentReal.new(-0.1).atan2((-1).Rat(1e-9)), -3.04192400109863, "DifferentReal.atan2(Rat)");
260+
is_approx(atan2(DifferentReal.new(0.1), (10).Rat(1e-9)), 0.00999966668666524, "atan2(DifferentReal, Rat)");
247261
}
248262

263+
#?niecza skip 'DifferentReal math NYI'
249264
{
250265
# DifferentReal vs Int tests
251-
is_approx(DifferentReal.new(-1).atan2((10).Int), -0.099668652491162, "DifferentReal.atan2(Int)");
252-
is_approx(atan2(DifferentReal.new(-1), (-100).Int), -3.13159298690313, "atan2(DifferentReal, Int)");
266+
is_approx(DifferentReal.new(1).atan2((1).Int), 0.785398163397448, "DifferentReal.atan2(Int)");
267+
is_approx(atan2(DifferentReal.new(1), (1).Int), 0.785398163397448, "atan2(DifferentReal, Int)");
253268
}
254269

270+
#?niecza skip 'Str math NYI'
255271
{
256272
# DifferentReal vs Str tests
257-
is_approx(DifferentReal.new(1).atan2((1).Str), 0.785398163397448, "DifferentReal.atan2(Str)");
258-
is_approx(atan2(DifferentReal.new(-1), (-0.1).Str), -1.67046497928606, "atan2(DifferentReal, Str)");
273+
is_approx(DifferentReal.new(-100).atan2((100).Str), -0.785398163397448, "DifferentReal.atan2(Str)");
274+
is_approx(atan2(DifferentReal.new(-0.1), (10).Str), -0.00999966668666524, "atan2(DifferentReal, Str)");
259275
}
260276

277+
#?niecza skip 'DifferentReal math NYI'
261278
{
262279
# DifferentReal vs DifferentReal tests
263-
is_approx(DifferentReal.new(-100).atan2(DifferentReal.new(-100)), -2.35619449019234, "DifferentReal.atan2(DifferentReal)");
264-
is_approx(atan2(DifferentReal.new(10), DifferentReal.new(1)), 1.47112767430373, "atan2(DifferentReal, DifferentReal)");
280+
is_approx(DifferentReal.new(100).atan2(DifferentReal.new(-0.1)), 1.57179632646156, "DifferentReal.atan2(DifferentReal)");
281+
is_approx(atan2(DifferentReal.new(-100), DifferentReal.new(10)), -1.47112767430373, "atan2(DifferentReal, DifferentReal)");
265282
}
266283

267284
done;

0 commit comments

Comments
 (0)