Lines Matching defs:ftest

175     # Common logic of MathTests.(ftest, test_testcases, test_mtestcases)
239 def ftest(self, name, got, expected, ulp_tol=5, abs_tol=0.0):
254 self.ftest('pi', math.pi, 3.141592653589793238462643)
255 self.ftest('e', math.e, 2.718281828459045235360287)
260 self.ftest('acos(-1)', math.acos(-1), math.pi)
261 self.ftest('acos(0)', math.acos(0), math.pi/2)
262 self.ftest('acos(1)', math.acos(1), 0)
271 self.ftest('acosh(1)', math.acosh(1), 0)
272 self.ftest('acosh(2)', math.acosh(2), 1.3169578969248168)
281 self.ftest('asin(-1)', math.asin(-1), -math.pi/2)
282 self.ftest('asin(0)', math.asin(0), 0)
283 self.ftest('asin(1)', math.asin(1), math.pi/2)
292 self.ftest('asinh(0)', math.asinh(0), 0)
293 self.ftest('asinh(1)', math.asinh(1), 0.88137358701954305)
294 self.ftest('asinh(-1)', math.asinh(-1), -0.88137358701954305)
301 self.ftest('atan(-1)', math.atan(-1), -math.pi/4)
302 self.ftest('atan(0)', math.atan(0), 0)
303 self.ftest('atan(1)', math.atan(1), math.pi/4)
304 self.ftest('atan(inf)', math.atan(INF), math.pi/2)
305 self.ftest('atan(-inf)', math.atan(NINF), -math.pi/2)
310 self.ftest('atanh(0)', math.atanh(0), 0)
311 self.ftest('atanh(0.5)', math.atanh(0.5), 0.54930614433405489)
312 self.ftest('atanh(-0.5)', math.atanh(-0.5), -0.54930614433405489)
321 self.ftest('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2)
322 self.ftest('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4)
323 self.ftest('atan2(0, 1)', math.atan2(0, 1), 0)
324 self.ftest('atan2(1, 1)', math.atan2(1, 1), math.pi/4)
325 self.ftest('atan2(1, 0)', math.atan2(1, 0), math.pi/2)
328 self.ftest('atan2(0., -inf)', math.atan2(0., NINF), math.pi)
329 self.ftest('atan2(0., -2.3)', math.atan2(0., -2.3), math.pi)
330 self.ftest('atan2(0., -0.)', math.atan2(0., -0.), math.pi)
336 self.ftest('atan2(-0., -inf)', math.atan2(-0., NINF), -math.pi)
337 self.ftest('atan2(-0., -2.3)', math.atan2(-0., -2.3), -math.pi)
338 self.ftest('atan2(-0., -0.)', math.atan2(-0., -0.), -math.pi)
344 self.ftest('atan2(inf, -inf)', math.atan2(INF, NINF), math.pi*3/4)
345 self.ftest('atan2(inf, -2.3)', math.atan2(INF, -2.3), math.pi/2)
346 self.ftest('atan2(inf, -0.)', math.atan2(INF, -0.0), math.pi/2)
347 self.ftest('atan2(inf, 0.)', math.atan2(INF, 0.0), math.pi/2)
348 self.ftest('atan2(inf, 2.3)', math.atan2(INF, 2.3), math.pi/2)
349 self.ftest('atan2(inf, inf)', math.atan2(INF, INF), math.pi/4)
352 self.ftest('atan2(-inf, -inf)', math.atan2(NINF, NINF), -math.pi*3/4)
353 self.ftest('atan2(-inf, -2.3)', math.atan2(NINF, -2.3), -math.pi/2)
354 self.ftest('atan2(-inf, -0.)', math.atan2(NINF, -0.0), -math.pi/2)
355 self.ftest('atan2(-inf, 0.)', math.atan2(NINF, 0.0), -math.pi/2)
356 self.ftest('atan2(-inf, 2.3)', math.atan2(NINF, 2.3), -math.pi/2)
357 self.ftest('atan2(-inf, inf)', math.atan2(NINF, INF), -math.pi/4)
360 self.ftest('atan2(2.3, -inf)', math.atan2(2.3, NINF), math.pi)
361 self.ftest('atan2(2.3, -0.)', math.atan2(2.3, -0.), math.pi/2)
362 self.ftest('atan2(2.3, 0.)', math.atan2(2.3, 0.), math.pi/2)
366 self.ftest('atan2(-2.3, -inf)', math.atan2(-2.3, NINF), -math.pi)
367 self.ftest('atan2(-2.3, -0.)', math.atan2(-2.3, -0.), -math.pi/2)
368 self.ftest('atan2(-2.3, 0.)', math.atan2(-2.3, 0.), -math.pi/2)
382 self.ftest('cbrt(0)', math.cbrt(0), 0)
383 self.ftest('cbrt(1)', math.cbrt(1), 1)
384 self.ftest('cbrt(8)', math.cbrt(8), 2)
385 self.ftest('cbrt(0.0)', math.cbrt(0.0), 0.0)
386 self.ftest('cbrt(-0.0)', math.cbrt(-0.0), -0.0)
387 self.ftest('cbrt(1.2)', math.cbrt(1.2), 1.062658569182611)
388 self.ftest('cbrt(-2.6)', math.cbrt(-2.6), -1.375068867074141)
389 self.ftest('cbrt(27)', math.cbrt(27), 3)
390 self.ftest('cbrt(-1)', math.cbrt(-1), -1)
391 self.ftest('cbrt(-27)', math.cbrt(-27), -3)
465 self.ftest('cos(-pi/2)', math.cos(-math.pi/2), 0, abs_tol=math.ulp(1))
466 self.ftest('cos(0)', math.cos(0), 1)
467 self.ftest('cos(pi/2)', math.cos(math.pi/2), 0, abs_tol=math.ulp(1))
468 self.ftest('cos(pi)', math.cos(math.pi), -1)
481 self.ftest('cosh(0)', math.cosh(0), 1)
482 self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
489 self.ftest('degrees(pi)', math.degrees(math.pi), 180.0)
490 self.ftest('degrees(pi/2)', math.degrees(math.pi/2), 90.0)
491 self.ftest('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0)
492 self.ftest('degrees(0)', math.degrees(0), 0)
496 self.ftest('exp(-1)', math.exp(-1), 1/math.e)
497 self.ftest('exp(0)', math.exp(0), 1)
498 self.ftest('exp(1)', math.exp(1), math.e)
506 self.ftest('exp2(-1)', math.exp2(-1), 0.5)
507 self.ftest('exp2(0)', math.exp2(0), 1)
508 self.ftest('exp2(1)', math.exp2(1), 2)
509 self.ftest('exp2(2.3)', math.exp2(2.3), 4.924577653379665)
517 self.ftest('fabs(-1)', math.fabs(-1), 1)
518 self.ftest('fabs(0)', math.fabs(0), 0)
519 self.ftest('fabs(1)', math.fabs(1), 1)
581 self.ftest('fmod(10, 1)', math.fmod(10, 1), 0.0)
582 self.ftest('fmod(10, 0.5)', math.fmod(10, 0.5), 0.0)
583 self.ftest('fmod(10, 1.5)', math.fmod(10, 1.5), 1.0)
584 self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0)
585 self.ftest('fmod(-10, 0.5)', math.fmod(-10, 0.5), -0.0)
586 self.ftest('fmod(-10, 1.5)', math.fmod(-10, 1.5), -1.0)
1113 self.ftest('ldexp(0,1)', math.ldexp(0,1), 0)
1114 self.ftest('ldexp(1,1)', math.ldexp(1,1), 2)
1115 self.ftest('ldexp(1,-1)', math.ldexp(1,-1), 0.5)
1116 self.ftest('ldexp(-1,1)', math.ldexp(-1,1), -2)
1145 self.ftest('log(1/e)', math.log(1/math.e), -1)
1146 self.ftest('log(1)', math.log(1), 0)
1147 self.ftest('log(e)', math.log(math.e), 1)
1148 self.ftest('log(32,2)', math.log(32,2), 5)
1149 self.ftest('log(10**40, 10)', math.log(10**40, 10), 40)
1150 self.ftest('log(10**40, 10**20)', math.log(10**40, 10**20), 2)
1151 self.ftest('log(10**1000)', math.log(10**1000),
1195 self.ftest('log10(0.1)', math.log10(0.1), -1)
1196 self.ftest('log10(1)', math.log10(1), 0)
1197 self.ftest('log10(10)', math.log10(10), 1)
1198 self.ftest('log10(10**1000)', math.log10(10**1000), 1000.0)
1226 self.ftest('pow(0,1)', math.pow(0,1), 0)
1227 self.ftest('pow(1,0)', math.pow(1,0), 1)
1228 self.ftest('pow(2,1)', math.pow(2,1), 2)
1229 self.ftest('pow(2,-1)', math.pow(2,-1), 0.5)
1350 self.ftest('(-2.)**3.', math.pow(-2.0, 3.0), -8.0)
1351 self.ftest('(-2.)**2.', math.pow(-2.0, 2.0), 4.0)
1352 self.ftest('(-2.)**1.', math.pow(-2.0, 1.0), -2.0)
1353 self.ftest('(-2.)**0.', math.pow(-2.0, 0.0), 1.0)
1354 self.ftest('(-2.)**-0.', math.pow(-2.0, -0.0), 1.0)
1355 self.ftest('(-2.)**-1.', math.pow(-2.0, -1.0), -0.5)
1356 self.ftest('(-2.)**-2.', math.pow(-2.0, -2.0), 0.25)
1357 self.ftest('(-2.)**-3.', math.pow(-2.0, -3.0), -0.125)
1375 self.ftest('radians(180)', math.radians(180), math.pi)
1376 self.ftest('radians(90)', math.radians(90), math.pi/2)
1377 self.ftest('radians(-45)', math.radians(-45), -math.pi/4)
1378 self.ftest('radians(0)', math.radians(0), 0)
1511 self.ftest('sin(0)', math.sin(0), 0)
1512 self.ftest('sin(pi/2)', math.sin(math.pi/2), 1)
1513 self.ftest('sin(-pi/2)', math.sin(-math.pi/2), -1)
1524 self.ftest('sinh(0)', math.sinh(0), 0)
1525 self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1)
1526 self.ftest('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0)
1533 self.ftest('sqrt(0)', math.sqrt(0), 0)
1534 self.ftest('sqrt(0)', math.sqrt(0.0), 0.0)
1535 self.ftest('sqrt(2.5)', math.sqrt(2.5), 1.5811388300841898)
1536 self.ftest('sqrt(0.25)', math.sqrt(0.25), 0.5)
1537 self.ftest('sqrt(25.25)', math.sqrt(25.25), 5.024937810560445)
1538 self.ftest('sqrt(1)', math.sqrt(1), 1)
1539 self.ftest('sqrt(4)', math.sqrt(4), 2)
1547 self.ftest('tan(0)', math.tan(0), 0)
1548 self.ftest('tan(pi/4)', math.tan(math.pi/4), 1)
1549 self.ftest('tan(-pi/4)', math.tan(-math.pi/4), -1)
1560 self.ftest('tanh(0)', math.tanh(0), 0)
1561 self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0,
1563 self.ftest('tanh(inf)', math.tanh(INF), 1)
1564 self.ftest('tanh(-inf)', math.tanh(NINF), -1)