blob: ccb1bf2fd3bf371e9ea6a4305c1a716344f5b11e [file]
# <!-- rdoc-file=math.c -->
# Module Math provides methods for basic trigonometric, logarithmic, and
# transcendental functions, and for extracting roots.
#
# You can write its constants and method calls thus:
#
# Math::PI # => 3.141592653589793
# Math::E # => 2.718281828459045
# Math.sin(0.0) # => 0.0
# Math.cos(0.0) # => 1.0
#
# If you include module Math, you can write simpler forms:
#
# include Math
# PI # => 3.141592653589793
# E # => 2.718281828459045
# sin(0.0) # => 0.0
# cos(0.0) # => 1.0
#
# For simplicity, the examples here assume:
#
# include Math
# INFINITY = Float::INFINITY
#
# The domains and ranges for the methods are denoted by open or closed
# intervals, using, respectively, parentheses or square brackets:
#
# * An open interval does not include the endpoints:
#
# (-INFINITY, INFINITY)
#
# * A closed interval includes the endpoints:
#
# [-1.0, 1.0]
#
# * A half-open interval includes one endpoint, but not the other:
#
# [1.0, INFINITY)
#
# Many values returned by Math methods are numerical approximations. This is
# because many such values are, in mathematics, of infinite precision, while in
# numerical computation the precision is finite.
#
# Thus, in mathematics, <em>cos(π/2)</em> is exactly zero, but in our
# computation <code>cos(PI/2)</code> is a number very close to zero:
#
# cos(PI/2) # => 6.123031769111886e-17
#
# For very large and very small returned values, we have added formatted numbers
# for clarity:
#
# tan(PI/2) # => 1.633123935319537e+16 # 16331239353195370.0
# tan(PI) # => -1.2246467991473532e-16 # -0.0000000000000001
#
# See class Float for the constants that affect Ruby's floating-point
# arithmetic.
#
# ### What's Here
#
# #### Trigonometric Functions
#
# * ::cos: Returns the cosine of the given argument.
# * ::sin: Returns the sine of the given argument.
# * ::tan: Returns the tangent of the given argument.
#
# #### Inverse Trigonometric Functions
#
# * ::acos: Returns the arc cosine of the given argument.
# * ::asin: Returns the arc sine of the given argument.
# * ::atan: Returns the arc tangent of the given argument.
# * ::atan2: Returns the arg tangent of two given arguments.
#
# #### Hyperbolic Trigonometric Functions
#
# * ::cosh: Returns the hyperbolic cosine of the given argument.
# * ::sinh: Returns the hyperbolic sine of the given argument.
# * ::tanh: Returns the hyperbolic tangent of the given argument.
#
# #### Inverse Hyperbolic Trigonometric Functions
#
# * ::acosh: Returns the inverse hyperbolic cosine of the given argument.
# * ::asinh: Returns the inverse hyperbolic sine of the given argument.
# * ::atanh: Returns the inverse hyperbolic tangent of the given argument.
#
# #### Exponentiation and Logarithmic Functions
#
# * ::exp: Returns the value of a given value raised to a given power.
# * ::log: Returns the logarithm of a given value in a given base.
# * ::log10: Returns the base 10 logarithm of the given argument.
# * ::log2: Returns the base 2 logarithm of the given argument.
#
# #### Fraction and Exponent Functions
#
# * ::frexp: Returns the fraction and exponent of the given argument.
# * ::ldexp: Returns the value for a given fraction and exponent.
#
# #### Root Functions
#
# * ::cbrt: Returns the cube root of the given argument.
# * ::sqrt: Returns the square root of the given argument.
#
# #### Error Functions
#
# * ::erf: Returns the value of the Gauss error function for the given
# argument.
# * ::erfc: Returns the value of the complementary error function for the
# given argument.
#
# #### Gamma Functions
#
# * ::gamma: Returns the value of the gamma function for the given argument.
# * ::lgamma: Returns the value of the logarithmic gamma function for the
# given argument.
#
# #### Hypotenuse Function
#
# * ::hypot: Returns <code>sqrt(a**2 + b**2)</code> for the given `a` and `b`.
#
module Math
# <!-- rdoc-file=math.c -->
# Definition of the mathematical constant E for Euler's number (e) as a Float
# number.
#
E: Float
# <!-- rdoc-file=math.c -->
# Definition of the mathematical constant PI as a Float number.
#
PI: Float
# <!-- rdoc-file=math.c -->
# Raised when a mathematical function is evaluated outside of its domain of
# definition.
#
# For example, since `cos` returns values in the range -1..1, its inverse
# function `acos` is only defined on that interval:
#
# Math.acos(42)
#
# <em>produces:</em>
#
# Math::DomainError: Numerical argument is out of domain - "acos"
#
class DomainError < StandardError
end
# A type that's passable to `Math` functions: A `Numeric` type that defines `.to_f`.
#
type double = Numeric & _ToF
# <!--
# rdoc-file=math.c
# - Math.acos(x) -> float
# -->
# Returns the [arc
# cosine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of `x`.
#
# * Domain: <code>[-1, 1]</code>.
# * Range: <code>[0, PI]</code>.
#
# Examples:
#
# acos(-1.0) # => 3.141592653589793 # PI
# acos(0.0) # => 1.5707963267948966 # PI/2
# acos(1.0) # => 0.0
#
def self.acos: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.acosh(x) -> float
# -->
# Returns the [inverse hyperbolic
# cosine](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`.
#
# * Domain: <code>[1, INFINITY]</code>.
# * Range: <code>[0, INFINITY]</code>.
#
# Examples:
#
# acosh(1.0) # => 0.0
# acosh(INFINITY) # => Infinity
#
def self.acosh: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.asin(x) -> float
# -->
# Returns the [arc
# sine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of `x`.
#
# * Domain: <code>[-1, -1]</code>.
# * Range: <code>[-PI/2, PI/2]</code>.
#
# Examples:
#
# asin(-1.0) # => -1.5707963267948966 # -PI/2
# asin(0.0) # => 0.0
# asin(1.0) # => 1.5707963267948966 # PI/2
#
def self.asin: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.asinh(x) -> float
# -->
# Returns the [inverse hyperbolic
# sine](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# asinh(-INFINITY) # => -Infinity
# asinh(0.0) # => 0.0
# asinh(INFINITY) # => Infinity
#
def self.asinh: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.atan(x) -> Float
# -->
# Returns the [arc
# tangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of
# `x`.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-PI/2, PI/2] </code>.
#
# Examples:
#
# atan(-INFINITY) # => -1.5707963267948966 # -PI2
# atan(-PI) # => -1.2626272556789115
# atan(-PI/2) # => -1.0038848218538872
# atan(0.0) # => 0.0
# atan(PI/2) # => 1.0038848218538872
# atan(PI) # => 1.2626272556789115
# atan(INFINITY) # => 1.5707963267948966 # PI/2
#
def self.atan: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.atan2(y, x) -> float
# -->
# Returns the [arc tangent](https://en.wikipedia.org/wiki/Atan2) of `y` and `x`
# in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain of `y`: <code>[-INFINITY, INFINITY]</code>.
# * Domain of `x`: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-PI, PI]</code>.
#
# Examples:
#
# atan2(-1.0, -1.0) # => -2.356194490192345 # -3*PI/4
# atan2(-1.0, 0.0) # => -1.5707963267948966 # -PI/2
# atan2(-1.0, 1.0) # => -0.7853981633974483 # -PI/4
# atan2(0.0, -1.0) # => 3.141592653589793 # PI
#
def self.atan2: (double y, double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.atanh(x) -> float
# -->
# Returns the [inverse hyperbolic
# tangent](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`.
#
# * Domain: <code>[-1, 1]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# atanh(-1.0) # => -Infinity
# atanh(0.0) # => 0.0
# atanh(1.0) # => Infinity
#
def self.atanh: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.cbrt(x) -> float
# -->
# Returns the [cube root](https://en.wikipedia.org/wiki/Cube_root) of `x`.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# cbrt(-INFINITY) # => -Infinity
# cbrt(-27.0) # => -3.0
# cbrt(-8.0) # => -2.0
# cbrt(-2.0) # => -1.2599210498948732
# cbrt(1.0) # => 1.0
# cbrt(0.0) # => 0.0
# cbrt(1.0) # => 1.0
# cbrt(2.0) # => 1.2599210498948732
# cbrt(8.0) # => 2.0
# cbrt(27.0) # => 3.0
# cbrt(INFINITY) # => Infinity
#
def self.cbrt: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.cos(x) -> float
# -->
# Returns the [cosine](https://en.wikipedia.org/wiki/Sine_and_cosine) of `x` in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain: <code>(-INFINITY, INFINITY)</code>.
# * Range: <code>[-1.0, 1.0]</code>.
#
# Examples:
#
# cos(-PI) # => -1.0
# cos(-PI/2) # => 6.123031769111886e-17 # 0.0000000000000001
# cos(0.0) # => 1.0
# cos(PI/2) # => 6.123031769111886e-17 # 0.0000000000000001
# cos(PI) # => -1.0
#
def self.cos: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.cosh(x) -> float
# -->
# Returns the [hyperbolic
# cosine](https://en.wikipedia.org/wiki/Hyperbolic_functions) of `x` in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[1, INFINITY]</code>.
#
# Examples:
#
# cosh(-INFINITY) # => Infinity
# cosh(0.0) # => 1.0
# cosh(INFINITY) # => Infinity
#
def self.cosh: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.erf(x) -> float
# -->
# Returns the value of the [Gauss error
# function](https://en.wikipedia.org/wiki/Error_function) for `x`.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-1, 1]</code>.
#
# Examples:
#
# erf(-INFINITY) # => -1.0
# erf(0.0) # => 0.0
# erf(INFINITY) # => 1.0
#
# Related: Math.erfc.
#
def self.erf: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.erfc(x) -> Float
# -->
# Returns the value of the [complementary error
# function](https://en.wikipedia.org/wiki/Error_function#Complementary_error_fun
# ction) for `x`.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[0, 2]</code>.
#
# Examples:
#
# erfc(-INFINITY) # => 2.0
# erfc(0.0) # => 1.0
# erfc(INFINITY) # => 0.0
#
# Related: Math.erf.
#
def self.erfc: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.exp(x) -> float
# -->
# Returns `e` raised to the `x` power.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[0, INFINITY]</code>.
#
# Examples:
#
# exp(-INFINITY) # => 0.0
# exp(-1.0) # => 0.36787944117144233 # 1.0/E
# exp(0.0) # => 1.0
# exp(0.5) # => 1.6487212707001282 # sqrt(E)
# exp(1.0) # => 2.718281828459045 # E
# exp(2.0) # => 7.38905609893065 # E**2
# exp(INFINITY) # => Infinity
#
def self.exp: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.expm1(x) -> float
# -->
# Returns "exp(x) - 1", `e` raised to the `x` power, minus 1.
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-1.0, INFINITY]</code>.
#
# Examples:
#
# expm1(-INFINITY) # => 0.0
# expm1(-1.0) # => -0.6321205588285577 # 1.0/E - 1
# expm1(0.0) # => 0.0
# expm1(0.5) # => 0.6487212707001282 # sqrt(E) - 1
# expm1(1.0) # => 1.718281828459045 # E - 1
# expm1(2.0) # => 6.38905609893065 # E**2 - 1
# expm1(INFINITY) # => Infinity
#
def self.expm1: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.frexp(x) -> [fraction, exponent]
# -->
# Returns a 2-element array containing the normalized signed float `fraction`
# and integer `exponent` of `x` such that:
#
# x = fraction * 2**exponent
#
# See [IEEE 754 double-precision binary floating-point format:
# binary64](https://en.wikipedia.org/wiki/Double-precision_floating-point_format
# #IEEE_754_double-precision_binary_floating-point_format:_binary64).
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# frexp(-INFINITY) # => [-Infinity, -1]
# frexp(-2.0) # => [-0.5, 2]
# frexp(-1.0) # => [-0.5, 1]
# frexp(0.0) # => [0.0, 0]
# frexp(1.0) # => [0.5, 1]
# frexp(2.0) # => [0.5, 2]
# frexp(INFINITY) # => [Infinity, -1]
#
# Related: Math.ldexp (inverse of Math.frexp).
#
def self.frexp: (double x) -> [Float, Integer]
# <!--
# rdoc-file=math.c
# - Math.gamma(x) -> float
# -->
# Returns the value of the [gamma
# function](https://en.wikipedia.org/wiki/Gamma_function) for `x`.
#
# * Domain: <code>(-INFINITY, INFINITY]</code> excluding negative integers.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# gamma(-2.5) # => -0.9453087204829431
# gamma(-1.5) # => 2.3632718012073513
# gamma(-0.5) # => -3.5449077018110375
# gamma(0.0) # => Infinity
# gamma(1.0) # => 1.0
# gamma(2.0) # => 1.0
# gamma(3.0) # => 2.0
# gamma(4.0) # => 6.0
# gamma(5.0) # => 24.0
#
# Related: Math.lgamma.
#
def self.gamma: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.hypot(a, b) -> float
# -->
# Returns <code>sqrt(a**2 + b**2)</code>, which is the length of the longest
# side `c` (the hypotenuse) of the right triangle whose other sides have lengths
# `a` and `b`.
#
# * Domain of `a`: <code>[-INFINITY, INFINITY]</code>.
# * Domain of +ab: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[0, INFINITY]</code>.
#
# Examples:
#
# hypot(0.0, 1.0) # => 1.0
# hypot(1.0, 1.0) # => 1.4142135623730951 # sqrt(2.0)
# hypot(3.0, 4.0) # => 5.0
# hypot(5.0, 12.0) # => 13.0
# hypot(1.0, sqrt(3.0)) # => 1.9999999999999998 # Near 2.0
#
# Note that if either argument is `INFINITY` or <code>-INFINITY</code>, the
# result is `Infinity`.
#
def self.hypot: (double x, double y) -> Float
# <!--
# rdoc-file=math.c
# - Math.ldexp(fraction, exponent) -> float
# -->
# Returns the value of <code>fraction * 2**exponent</code>.
#
# * Domain of `fraction`: <code>[0.0, 1.0)</code>.
# * Domain of `exponent`: <code>[0, 1024]</code> (larger values are equivalent
# to 1024).
#
# See [IEEE 754 double-precision binary floating-point format:
# binary64](https://en.wikipedia.org/wiki/Double-precision_floating-point_format
# #IEEE_754_double-precision_binary_floating-point_format:_binary64).
#
# Examples:
#
# ldexp(-INFINITY, -1) # => -Infinity
# ldexp(-0.5, 2) # => -2.0
# ldexp(-0.5, 1) # => -1.0
# ldexp(0.0, 0) # => 0.0
# ldexp(-0.5, 1) # => 1.0
# ldexp(-0.5, 2) # => 2.0
# ldexp(INFINITY, -1) # => Infinity
#
# Related: Math.frexp (inverse of Math.ldexp).
#
def self.ldexp: (double fraction, int exponent) -> Float
# <!--
# rdoc-file=math.c
# - Math.lgamma(x) -> [float, -1 or 1]
# -->
# Returns a 2-element array equivalent to:
#
# [Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]
#
# See [log gamma
# function](https://en.wikipedia.org/wiki/Gamma_function#Log-gamma_function).
#
# * Domain: <code>(-INFINITY, INFINITY]</code>.
# * Range of first element: <code>(-INFINITY, INFINITY]</code>.
# * Second element is -1 or 1.
#
# Examples:
#
# lgamma(-4.0) # => [Infinity, -1]
# lgamma(-3.0) # => [Infinity, -1]
# lgamma(-2.0) # => [Infinity, -1]
# lgamma(-1.0) # => [Infinity, -1]
# lgamma(0.0) # => [Infinity, 1]
#
# lgamma(1.0) # => [0.0, 1]
# lgamma(2.0) # => [0.0, 1]
# lgamma(3.0) # => [0.6931471805599436, 1]
# lgamma(4.0) # => [1.7917594692280545, 1]
#
# lgamma(-2.5) # => [-0.05624371649767279, -1]
# lgamma(-1.5) # => [0.8600470153764797, 1]
# lgamma(-0.5) # => [1.265512123484647, -1]
# lgamma(0.5) # => [0.5723649429247004, 1]
# lgamma(1.5) # => [-0.12078223763524676, 1]
# lgamma(2.5) # => [0.2846828704729205, 1]
#
# Related: Math.gamma.
#
def self.lgamma: (double x) -> [Float, -1 | 1]
# <!--
# rdoc-file=math.c
# - Math.log(x, base = Math::E) -> Float
# -->
# Returns the base `base` [logarithm](https://en.wikipedia.org/wiki/Logarithm)
# of `x`.
#
# * Domain: <code>[0, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY)]</code>.
#
# Examples:
#
# log(0.0) # => -Infinity
# log(1.0) # => 0.0
# log(E) # => 1.0
# log(INFINITY) # => Infinity
#
# log(0.0, 2.0) # => -Infinity
# log(1.0, 2.0) # => 0.0
# log(2.0, 2.0) # => 1.0
#
# log(0.0, 10.0) # => -Infinity
# log(1.0, 10.0) # => 0.0
# log(10.0, 10.0) # => 1.0
#
def self.log: (double x, ?double base) -> Float
# <!--
# rdoc-file=math.c
# - Math.log10(x) -> float
# -->
# Returns the base 10 [logarithm](https://en.wikipedia.org/wiki/Logarithm) of
# `x`.
#
# * Domain: <code>[0, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# log10(0.0) # => -Infinity
# log10(1.0) # => 0.0
# log10(10.0) # => 1.0
# log10(INFINITY) # => Infinity
#
def self.log10: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.log1p(x) -> float
# -->
# Returns "log(x + 1)", the base E
# [logarithm](https://en.wikipedia.org/wiki/Logarithm) of (`x` + 1).
#
# * Domain: <code>[-1, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# log1p(-1.0) # => -Infinity
# log1p(0.0) # => 0.0
# log1p(E - 1) # => 1.0
# log1p(INFINITY) # => Infinity
#
def self.log1p: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.log2(x) -> float
# -->
# Returns the base 2 [logarithm](https://en.wikipedia.org/wiki/Logarithm) of
# `x`.
#
# * Domain: <code>[0, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# log2(0.0) # => -Infinity
# log2(1.0) # => 0.0
# log2(2.0) # => 1.0
# log2(INFINITY) # => Infinity
#
def self.log2: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.sin(x) -> float
# -->
# Returns the [sine](https://en.wikipedia.org/wiki/Sine_and_cosine) of `x` in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain: <code>(-INFINITY, INFINITY)</code>.
# * Range: <code>[-1.0, 1.0]</code>.
#
# Examples:
#
# sin(-PI) # => -1.2246063538223773e-16 # -0.0000000000000001
# sin(-PI/2) # => -1.0
# sin(0.0) # => 0.0
# sin(PI/2) # => 1.0
# sin(PI) # => 1.2246063538223773e-16 # 0.0000000000000001
#
def self.sin: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.sinh(x) -> float
# -->
# Returns the [hyperbolic
# sine](https://en.wikipedia.org/wiki/Hyperbolic_functions) of `x` in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-INFINITY, INFINITY]</code>.
#
# Examples:
#
# sinh(-INFINITY) # => -Infinity
# sinh(0.0) # => 0.0
# sinh(INFINITY) # => Infinity
#
def self.sinh: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.sqrt(x) -> float
# -->
# Returns the principal (non-negative) [square
# root](https://en.wikipedia.org/wiki/Square_root) of `x`.
#
# * Domain: <code>[0, INFINITY]</code>.
# * Range: <code>[0, INFINITY]</code>.
#
# Examples:
#
# sqrt(0.0) # => 0.0
# sqrt(0.5) # => 0.7071067811865476
# sqrt(1.0) # => 1.0
# sqrt(2.0) # => 1.4142135623730951
# sqrt(4.0) # => 2.0
# sqrt(9.0) # => 3.0
# sqrt(INFINITY) # => Infinity
#
def self.sqrt: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.tan(x) -> float
# -->
# Returns the [tangent](https://en.wikipedia.org/wiki/Trigonometric_functions)
# of `x` in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain: <code>(-INFINITY, INFINITY)</code>.
# * Range: <code>(-INFINITY, INFINITY)</code>.
#
# Examples:
#
# tan(-PI) # => 1.2246467991473532e-16 # -0.0000000000000001
# tan(-PI/2) # => -1.633123935319537e+16 # -16331239353195370.0
# tan(0.0) # => 0.0
# tan(PI/2) # => 1.633123935319537e+16 # 16331239353195370.0
# tan(PI) # => -1.2246467991473532e-16 # -0.0000000000000001
#
def self.tan: (double x) -> Float
# <!--
# rdoc-file=math.c
# - Math.tanh(x) -> float
# -->
# Returns the [hyperbolic
# tangent](https://en.wikipedia.org/wiki/Hyperbolic_functions) of `x` in
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
# _degrees).
#
# * Domain: <code>[-INFINITY, INFINITY]</code>.
# * Range: <code>[-1, 1]</code>.
#
# Examples:
#
# tanh(-INFINITY) # => -1.0
# tanh(0.0) # => 0.0
# tanh(INFINITY) # => 1.0
#
def self.tanh: (double x) -> Float
end