cpx

  1. Cpx!R cpx(R re)
  2. Cpx!(CommonType!(R, I)) cpx(R re, I im)
    Cpx!(CommonType!(R, I))
    cpx
    (
    R
    I
    )
    (
    R re
    ,
    I im
    )
    if ()
  3. Cpx!(typeof(C.init.re)) cpx(C c)

Examples

complex_t!float c1 = cpx(1.0f);
assert(c1.re == 1);
assert(c1.im == 0);

complex_t!float c2 = cpx(1.0f, 1.0f);
assert(c2.re == 1);
assert(c2.im == 1);

complex_t!float c3 = cpx(1.0f + 1.0fi);
assert(c2.re == 1);
assert(c2.im == 1);

cfloat c4 = cpx!std_complex_t(1.0f);
assert(c4.re == 1);
assert(c4.im == 0);

cfloat c5 = cpx!std_complex_t(1.0f, 1.0f);
assert(c5.re == 1);
assert(c5.im == 1);

cfloat c6 = cpx!std_complex_t(1.0f + 1.0fi);
assert(c6.re == 1);
assert(c6.im == 1);

Meta