Lines Matching refs:complex
10 complex_zeros = [complex(x, y) for x in [0.0, -0.0] for y in [0.0, -0.0]]
11 complex_infinities = [complex(x, y) for x, y in [
33 complex_nans = [complex(x, y) for x, y in [
295 return complex(*polar(z))
298 arg = complex(ar, ai)
299 expected = complex(er, ei)
327 actual = complex(abs(actual.real), actual.imag)
328 expected = complex(abs(expected.real), expected.imag)
330 actual = complex(actual.real, abs(actual.imag))
331 expected = complex(expected.real, abs(expected.imag))
365 check(complex(inf, 0), (inf, 0.))
366 check(complex(-inf, 0), (inf, pi))
367 check(complex(3, inf), (inf, pi / 2))
368 check(complex(5, -inf), (inf, -pi / 2))
369 check(complex(inf, inf), (inf, pi / 4))
370 check(complex(inf, -inf), (inf, -pi / 4))
371 check(complex(-inf, inf), (inf, 3 * pi / 4))
372 check(complex(-inf, -inf), (inf, -3 * pi / 4))
374 check(complex(nan, 0), (nan, nan))
375 check(complex(0, nan), (nan, nan))
376 check(complex(nan, nan), (nan, nan))
377 check(complex(inf, nan), (inf, nan))
378 check(complex(-inf, nan), (inf, nan))
379 check(complex(nan, inf), (inf, nan))
380 check(complex(nan, -inf), (inf, nan))
407 self.assertEqual(phase(complex(0.0, 0.0)), 0.0)
408 self.assertEqual(phase(complex(0.0, -0.0)), -0.0)
409 self.assertEqual(phase(complex(-0.0, 0.0)), pi)
410 self.assertEqual(phase(complex(-0.0, -0.0)), -pi)
413 self.assertAlmostEqual(phase(complex(-INF, -0.0)), -pi)
414 self.assertAlmostEqual(phase(complex(-INF, -2.3)), -pi)
415 self.assertAlmostEqual(phase(complex(-INF, -INF)), -0.75*pi)
416 self.assertAlmostEqual(phase(complex(-2.3, -INF)), -pi/2)
417 self.assertAlmostEqual(phase(complex(-0.0, -INF)), -pi/2)
418 self.assertAlmostEqual(phase(complex(0.0, -INF)), -pi/2)
419 self.assertAlmostEqual(phase(complex(2.3, -INF)), -pi/2)
420 self.assertAlmostEqual(phase(complex(INF, -INF)), -pi/4)
421 self.assertEqual(phase(complex(INF, -2.3)), -0.0)
422 self.assertEqual(phase(complex(INF, -0.0)), -0.0)
423 self.assertEqual(phase(complex(INF, 0.0)), 0.0)
424 self.assertEqual(phase(complex(INF, 2.3)), 0.0)
425 self.assertAlmostEqual(phase(complex(INF, INF)), pi/4)
426 self.assertAlmostEqual(phase(complex(2.3, INF)), pi/2)
427 self.assertAlmostEqual(phase(complex(0.0, INF)), pi/2)
428 self.assertAlmostEqual(phase(complex(-0.0, INF)), pi/2)
429 self.assertAlmostEqual(phase(complex(-2.3, INF)), pi/2)
430 self.assertAlmostEqual(phase(complex(-INF, INF)), 0.75*pi)
431 self.assertAlmostEqual(phase(complex(-INF, 2.3)), pi)
432 self.assertAlmostEqual(phase(complex(-INF, 0.0)), pi)
448 self.assertEqual(abs(complex(NAN, -INF)), INF)
449 self.assertTrue(math.isnan(abs(complex(NAN, -2.3))))
450 self.assertTrue(math.isnan(abs(complex(NAN, -0.0))))
451 self.assertTrue(math.isnan(abs(complex(NAN, 0.0))))
452 self.assertTrue(math.isnan(abs(complex(NAN, 2.3))))
453 self.assertEqual(abs(complex(NAN, INF)), INF)
454 self.assertEqual(abs(complex(-INF, NAN)), INF)
455 self.assertTrue(math.isnan(abs(complex(-2.3, NAN))))
456 self.assertTrue(math.isnan(abs(complex(-0.0, NAN))))
457 self.assertTrue(math.isnan(abs(complex(0.0, NAN))))
458 self.assertTrue(math.isnan(abs(complex(2.3, NAN))))
459 self.assertEqual(abs(complex(INF, NAN)), INF)
460 self.assertTrue(math.isnan(abs(complex(NAN, NAN))))
464 self.assertRaises(OverflowError, abs, complex(1.4e308, 1.4e308))
483 self.assertTrue(cmath.isnan(complex(NAN, 0)))
484 self.assertTrue(cmath.isnan(complex(0, NAN)))
485 self.assertTrue(cmath.isnan(complex(NAN, NAN)))
486 self.assertTrue(cmath.isnan(complex(NAN, INF)))
487 self.assertTrue(cmath.isnan(complex(INF, NAN)))
494 self.assertTrue(cmath.isinf(complex(INF, 0)))
495 self.assertTrue(cmath.isinf(complex(0, INF)))
496 self.assertTrue(cmath.isinf(complex(INF, INF)))
497 self.assertTrue(cmath.isinf(complex(NAN, INF)))
498 self.assertTrue(cmath.isinf(complex(INF, NAN)))