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.

Visibility

1. Public
2. All

### Type Members

1. #### class BigDecimal extends ScalaNumber with ScalaNumericConversions with Serializable

2. #### class BigInt extends ScalaNumber with ScalaNumericConversions with Serializable

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

   A trait for representing equivalence relations.

4. #### trait Fractional[T] extends Numeric[T]

5. #### trait Integral[T] extends Numeric[T]

6. #### trait LowPriorityEquiv extends AnyRef

7. #### trait LowPriorityOrderingImplicits extends AnyRef

8. #### trait Numeric[T] extends Ordering[T]

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 ScalaNumericConversions extends ScalaNumber

    Conversions which present a consistent conversion interface across all the numeric types.

### Value Members

1. #### object BigDecimal extends Serializable

2. #### object BigInt extends Serializable

3. #### val E: Double

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

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

   Definition Classes
     package

4. #### object Equiv extends LowPriorityEquiv

5. #### object Fractional extends Serializable

6. #### def IEEEremainder(x: Double, y: Double): Double

   Definition Classes
     package

7. #### object Integral extends Serializable

8. #### object Numeric extends Serializable

9. #### object Ordered extends AnyRef

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

    This is the companion object for the 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.

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

    Definition Classes
      package

12. #### def abs(x: Double): Double

    Definition Classes
      package

13. #### def abs(x: Float): Float

    Definition Classes
      package

14. #### def abs(x: Long): Long

    Definition Classes
      package

15. #### def abs(x: Int): Int

    Definition Classes
      package

16. #### def acos(x: Double): Double

    Definition Classes
      package

17. #### def asin(x: Double): Double

    Definition Classes
      package

18. #### def atan(x: Double): Double

    Definition Classes
      package

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.

    Definition Classes
      package

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

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

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

    Definition Classes
      package

21. #### def ceil(x: Double): Double

    Definition Classes
      package

22. #### def cos(x: Double): Double

    Definition Classes
      package

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

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

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

    Definition Classes
      package

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.

    Definition Classes
      package

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

    Returns `exp(x) - 1`.

    Returns `exp(x) - 1`.

    Definition Classes
      package

26. #### def floor(x: Double): Double

    Definition Classes
      package

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.

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

    Definition Classes
      package

28. #### def log(x: Double): Double

    Definition Classes
      package

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

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

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

    Definition Classes
      package

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

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

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

    Definition Classes
      package

31. #### def max(x: Double, y: Double): Double

    Definition Classes
      package

32. #### def max(x: Float, y: Float): Float

    Definition Classes
      package

33. #### def max(x: Long, y: Long): Long

    Definition Classes
      package

34. #### def max(x: Int, y: Int): Int

    Definition Classes
      package

35. #### def min(x: Double, y: Double): Double

    Definition Classes
      package

36. #### def min(x: Float, y: Float): Float

    Definition Classes
      package

37. #### def min(x: Long, y: Long): Long

    Definition Classes
      package

38. #### def min(x: Int, y: Int): Int

    Definition Classes
      package

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`.

    Definition Classes
      package

40. #### def random: Double

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

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

    Definition Classes
      package

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.

    Definition Classes
      package

42. #### def round(x: Double): Long

    Definition Classes
      package

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.

    Definition Classes
      package

44. #### def signum(x: Int): Int

    Definition Classes
      package

45. #### def signum(x: Long): Long

    Definition Classes
      package

46. #### def signum(x: Float): Float

    Definition Classes
      package

47. #### def signum(x: Double): Double

    Definition Classes
      package

48. #### def sin(x: Double): Double

    Definition Classes
      package

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

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

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

    Definition Classes
      package

50. #### def sqrt(x: Double): Double

    Definition Classes
      package

51. #### def tan(x: Double): Double

    Definition Classes
      package

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

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

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

    Definition Classes
      package

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

      angle, in radians

    returns

      the measurement of the angle `x` in degrees.

    Definition Classes
      package

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.

    Definition Classes
      package

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

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

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

    Definition Classes
      package

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

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

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

    Definition Classes
      package