 scala

# math

#### package math

The package object `scala.math` contains methods for performing basic numeric operations such as elementary exponential, logarithmic, root and trigonometric functions.

Linear Supertypes
Ordering
1. Alphabetic
2. By inheritance
Inherited
1. math
2. AnyRef
3. Any
1. Hide All
2. Show all
Visibility
1. Public
2. All

### Type Members

3. #### trait Equiv[T] extends Serializable

A trait for representing equivalence relations.

9. #### trait Ordered[A] extends Comparable[A]

A trait for data that have a single, natural ordering.

10. #### trait Ordering[T] extends Comparator[T] with PartialOrdering[T] with Serializable

Ordering is a trait whose instances each represent a strategy for sorting instances of a type.

11. #### trait PartialOrdering[T] extends Equiv[T]

A trait for representing partial orderings.

12. #### trait PartiallyOrdered[+A] extends AnyRef

A class for partially ordered data.

13. #### trait ScalaNumericAnyConversions extends Any

Conversions which present a consistent conversion interface across all the numeric types, suitable for use in value classes.

14. #### trait ScalaNumericConversions extends ScalaNumber with ScalaNumericAnyConversions

A slightly more specific conversion trait for classes which extend ScalaNumber (which excludes value classes.

### Value Members

3. #### val E: Double

The `double` value that is closer than any other to `e`, the base of the natural logarithms.

10. #### object Ordering extends LowPriorityOrderingImplicits with Serializable

This is the companion object for the scala.math.Ordering trait.

11. #### val Pi: Double

The `double` value that is closer than any other to `pi`, the ratio of the circumference of a circle to its diameter.

19. #### def atan2(y: Double, x: Double): Double

Converts rectangular coordinates `(x, y)` to polar `(r, theta)`.

Converts rectangular coordinates `(x, y)` to polar `(r, theta)`.

y

the abscissa coordinate

x

the ordinate coordinate

returns

the theta component of the point `(r, theta)` in polar coordinates that corresponds to the point `(x, y)` in Cartesian coordinates.

20. #### def cbrt(x: Double): Double

Returns the cube root of the given `Double` value.

23. #### def cosh(x: Double): Double

Returns the hyperbolic cosine of the given `Double` value.

24. #### def exp(x: Double): Double

Returns Euler's number `e` raised to the power of a `double` value.

Returns Euler's number `e` raised to the power of a `double` value.

x

the exponent to raise `e` to.

returns

the value `ea`, where `e` is the base of the natural logarithms.

25. #### def expm1(x: Double): Double

Returns `exp(x) - 1`.

27. #### def hypot(x: Double, y: Double): Double

Returns the square root of the sum of the squares of both given `Double` values without intermediate underflow or overflow.

29. #### def log10(x: Double): Double

Returns the base 10 logarithm of the given `Double` value.

30. #### def log1p(x: Double): Double

Returns the natural logarithm of the sum of the given `Double` value and 1.

39. #### def pow(x: Double, y: Double): Double

Returns the value of the first argument raised to the power of the second argument.

Returns the value of the first argument raised to the power of the second argument.

x

the base.

y

the exponent.

returns

the value `xy`.

40. #### def random: Double

Returns a `double` value with a positive sign, greater than or equal to `0.0` and less than `1.0`.

41. #### def rint(x: Double): Double

Returns the `double` value that is closest in value to the argument and is equal to a mathematical integer.

Returns the `double` value that is closest in value to the argument and is equal to a mathematical integer.

x

a `double` value

returns

the closest floating-point value to a that is equal to a mathematical integer.

43. #### def round(x: Float): Int

Returns the closest `long` to the argument.

Returns the closest `long` to the argument.

x

a floating-point value to be rounded to a `long`.

returns

the value of the argument rounded to the nearest`long` value.

49. #### def sinh(x: Double): Double

Returns the hyperbolic sine of the given `Double` value.

52. #### def tanh(x: Double): Double

Returns the hyperbolic tangent of the given `Double` value.

53. #### def toDegrees(x: Double): Double

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

x

returns

the measurement of the angle `x` in degrees.

54. #### def toRadians(x: Double): Double

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

x

an angle, in degrees

returns

the measurement of the angle `x` in radians.

55. #### def ulp(x: Float): Float

Returns the size of an ulp of the given `Float` value.

56. #### def ulp(x: Double): Double

Returns the size of an ulp of the given `Double` value.