scala

# math

#### package math

The package object `scala.math` contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square 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
     MathCommon

4. #### object Equiv extends LowPriorityEquiv

5. #### object Fractional extends Serializable

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

   Definition Classes
     MathCommon

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
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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
      MathCommon

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

    Definition Classes
      package

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    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
      MathCommon

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

    Definition Classes
      package

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

    Definition Classes
      MathCommon

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

    Definition Classes
      package

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

    Definition Classes
      MathCommon

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

    Definition Classes
      package

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

    Definition Classes
      package

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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
      MathCommon

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
      MathCommon

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
      MathCommon

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

    Definition Classes
      MathCommon

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
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    Definition Classes
      package

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

    Definition Classes
      MathCommon

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

    Definition Classes
      MathCommon

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

    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
      MathCommon

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
      MathCommon

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

    Definition Classes
      package

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

    Definition Classes
      package