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.

Source
  package.scala

Linear Supertypes
AnyRef, Any
Content Hierarchy Learn more about scaladoc diagrams
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. math
2. AnyRef
3. Any

1. Hide All
2. Show all

Learn more about member selection
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 Serializable

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

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.

4. #### object Equiv extends LowPriorityEquiv with Serializable

5. #### object Fractional extends Serializable

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

7. #### object Integral extends Serializable

8. #### object Numeric extends Serializable

9. #### object Ordered

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.

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

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

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

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

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

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

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

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.

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

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

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

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

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.

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

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.

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

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

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

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

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

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

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

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

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.

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

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.

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

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

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

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

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

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

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

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

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

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

      angle, in radians

    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.

### Inherited from AnyRef

### Inherited from Any

### Ungrouped