File: complex_numbers_cmath_T2891.pyx

package info (click to toggle)
cython 3.1.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,932 kB
  • sloc: python: 92,172; ansic: 19,275; cpp: 1,407; xml: 1,031; javascript: 511; makefile: 373; sh: 223; sed: 11
file content (15 lines) | stat: -rw-r--r-- 317 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ticket: 2891
# tag: c, no-cpp

cdef extern from "complex_numbers_c99_T398.h": pass

from libc.complex cimport cimag, creal, cabs, carg


def test_decomposing(double complex z):
    """
    >>> test_decomposing(3+4j)
    (3.0, 4.0, 5.0, 0.9272952180016122)
    """

    return (creal(z), cimag(z), cabs(z), carg(z))