Index of Classes & Methods in cmath: Ruby Standard Library Documentation (Ruby 2.2.2)

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

#### Ruby 2.2.2

New to Ruby? You may find these links helpful: syntax, control expressions, assignment, methods, modules + classes, and operator precedence.

CMath is a library that provides trigonometric and transcendental functions for complex numbers.

## Usage¶ ↑

To start using this library, simply:

    require "cmath"

Square root of a negative number is a complex number.

    CMath.sqrt(-9)  #=> 0+3.0i

Classes

M CMath

Methods

::acos (CMath)

::acos! (CMath)

::acosh (CMath)

::acosh! (CMath)

::asin (CMath)

::asin! (CMath)

::asinh (CMath)

::asinh! (CMath)

::atan (CMath)

::atan! (CMath)

::atan2 (CMath)

::atan2! (CMath)

::atanh (CMath)

::atanh! (CMath)

::cbrt (CMath)

::cbrt! (CMath)

::cos (CMath)

::cos! (CMath)

::cosh (CMath)

::cosh! (CMath)

::exp (CMath)

::exp! (CMath)

::log (CMath)

::log! (CMath)

::log10 (CMath)

::log10! (CMath)

::log2 (CMath)

::log2! (CMath)

::sin (CMath)

::sin! (CMath)

::sinh (CMath)

::sinh! (CMath)

::sqrt (CMath)

::sqrt! (CMath)

::tan (CMath)

::tan! (CMath)

::tanh (CMath)

::tanh! (CMath)