tan

Trigonometric functions on complex numbers.

@safe pure nothrow @nogc
tan
(
T
)

Return Value

Type: Complex!T

The sine, cosine and tangent of z, respectively.

Examples

static import std.math;

int ceqrel(T)(const Complex!T x, const Complex!T y) @safe pure nothrow @nogc
{
    import std.math.operations : feqrel;
    const r = feqrel(x.re, y.re);
    const i = feqrel(x.im, y.im);
    return r < i ? r : i;
}
assert(ceqrel(tan(complex(1.0, 0.0)), complex(std.math.tan(1.0), 0.0)) >= double.mant_dig - 2);
assert(ceqrel(tan(complex(0.0, 1.0)), complex(0.0, std.math.tanh(1.0))) >= double.mant_dig - 2);
static import core.math;
assert(sin(complex(0.0)) == 0.0);
assert(sin(complex(2.0, 0)) == core.math.sin(2.0));
static import core.math;
static import std.math;
assert(cos(complex(0.0)) == 1.0);
assert(cos(complex(1.3, 0.0)) == core.math.cos(1.3));
assert(cos(complex(0.0, 5.2)) == std.math.cosh(5.2));

Meta