tan function
dynamic
tan(
- dynamic x
Returns the tangent of a number in radians.
Example 1:
print(tan(math.pi / 4)); // Output: 1.0
Example 2:
var z = Complex(0, 0);
var z_cos = tan(z);
print(z_cos); // Output: 1.0 + 0.0i
Implementation
dynamic tan(dynamic x) {
if (x is num) {
return math.tan(x);
} else if (x is Complex) {
return sin(x) / cos(x);
} else {
throw ArgumentError('Input should be either num or Complex');
}
}