 /*
  * for the compatibility's sake w/ C++11
  */
-/// absolute value of z
+/// absolute value of z in T:RealType
 public func abs<T>(z:Complex<T>) -> T { return z.abs }
-/// argument of z
+/// argument of z in T:RealType
 public func arg<T>(z:Complex<T>) -> T { return z.arg }
-/// real part of z
+/// real part of z in T:RealType
 public func real<T>(z:Complex<T>) -> T { return z.real }
-/// imaginary part of z
+/// imaginary part of z in T:RealType
 public func imag<T>(z:Complex<T>) -> T { return z.imag }
-/// norm of z
+/// norm of z in T:RealType
 public func norm<T>(z:Complex<T>) -> T { return z.norm }
-/// conjugate of z
+/// conjugate of z in Complex
 public func conj<T>(z:Complex<T>) -> Complex<T> { return z.conj }
-/// projection of z
+/// projection of z in Complex
 public func proj<T>(z:Complex<T>) -> Complex<T> { return z.proj }
 //
 // approximate comparisons

        return Complex(r,  T.sqrt((-z.re + d)/T(2)))
    }
}
/// cos(z)
public func cos<T>(z:Complex<T>) -> Complex<T> {
    //return (exp(z.i) + exp(-z.i)) / T(2)
    return Complex(T.cos(z.re)*T.cosh(z.im), -T.sin(z.re)*T.sinh(z.im))
}
/// sin(z)
public func sin<T>(z:Complex<T>) -> Complex<T> {
    // return -(exp(z.i) - exp(-z.i)).i / T(2)
    return Complex(T.sin(z.re)*T.cosh(z.im), +T.cos(z.re)*T.sinh(z.im))
}
/// tan(z)
public func tan<T>(z:Complex<T>) -> Complex<T> {
    return sin(z) / cos(z)
}
/// atan(z)
public func atan<T>(z:Complex<T>) -> Complex<T> {
    let lp = log(T(1) - z.i), lm = log(T(1) + z.i)
    return (lp - lm).i / T(2)
}
/// asin(z)
public func asin<T>(z:Complex<T>) -> Complex<T> {
    return -log(z.i + sqrt(T(1) - z*z)).i
}
/// acos(z)
public func acos<T>(z:Complex<T>) -> Complex<T> {
    return log(z - sqrt(T(1) - z*z).i).i
}
/// sinh(z)
public func sinh<T>(z:Complex<T>) -> Complex<T> {
    // return (exp(z) - exp(-z)) / T(2)
    return -sin(z.i).i;
}
/// cosh(z)
public func cosh<T>(z:Complex<T>) -> Complex<T> {
    // return (exp(z) + exp(-z)) / T(2)
    return cos(z.i);
}
/// tanh(z)
public func tanh<T>(z:Complex<T>) -> Complex<T> {
    // let ez = exp(z), e_z = exp(-z)
    // return (ez - e_z) / (ez + e_z)
    return sinh(z) / cosh(z)
}
/// asinh(z)
public func asinh<T>(z:Complex<T>) -> Complex<T> {
    return log(z + sqrt(z*z + T(1)))
}
/// acosh(z)
public func acosh<T>(z:Complex<T>) -> Complex<T> {
    return log(z + sqrt(z*z - T(1)))
}
/// atanh(z)
public func atanh<T>(z:Complex<T>) -> Complex<T> {
    let tp = T(1) + z, tm = T(1) - z
    return log(tp / tm) / T(2)

        : -fx*2 == T(1) ? pow(lhs, ix) / sqrt(lhs)
        : pow(lhs, Complex(rhs, T(0)))
}
/// - returns: lhs ** rhs in Complex
public func pow<T>(lhs:T, _ rhs:Complex<T>) -> Complex<T> {
    return pow(Complex(lhs, T(0)), rhs)
}
