}
#if %(is_float)s
static CYTHON_INLINE %(real_type)s __Pyx_c_abs%(m)s(%(type)s z) {
- #if HAVE_HYPOT
- return hypot%(m)s(z.real, z.imag);
- #else
+ #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
return sqrt%(m)s(z.real*z.real + z.imag*z.imag);
+ #else
+ return hypot%(m)s(z.real, z.imag);
#endif
}
static CYTHON_INLINE %(type)s __Pyx_c_pow%(m)s(%(type)s a, %(type)s b) {
Various implementations produce slightly different results...
>>> a = complex(3, 1)
- >>> test_pow(a, 1)
- (3+1j)
+ >>> test_pow(a, 1, 1e-15)
+ True
>>> test_pow(a, 2, 1e-15)
True
>>> test_pow(a, a, 1e-15)
[True, True, True, True, True, True, True, True, True]
>>> [test_int_pow(complex(0, 2), k, 1e-15) for k in range(-4, 5)]
[True, True, True, True, True, True, True, True, True]
- >>> [test_int_pow(complex(2, 0.5), k, 1e-15) for k in range(0, 10)]
+ >>> [test_int_pow(complex(2, 0.5), k, 1e-14) for k in range(0, 10)]
[True, True, True, True, True, True, True, True, True, True]
"""
if tol is None: