diff options
author | Heather Miller <heather.miller@epfl.ch> | 2011-08-09 19:47:36 +0000 |
---|---|---|
committer | Heather Miller <heather.miller@epfl.ch> | 2011-08-09 19:47:36 +0000 |
commit | c773c47fe91ed074e13c306f6fa71a55e9f69a72 (patch) | |
tree | ce3cdc6e8e128b4b42d3e4a1d3e9d3034666c37b /src/library | |
parent | 84189c6b15fc390a9bc2dc67b9d57935a6933e90 (diff) | |
download | scala-c773c47fe91ed074e13c306f6fa71a55e9f69a72.tar.gz scala-c773c47fe91ed074e13c306f6fa71a55e9f69a72.tar.bz2 scala-c773c47fe91ed074e13c306f6fa71a55e9f69a72.zip |
Adds documentation to the scala.math package ob...
Adds documentation to the scala.math package object. Contributed by
Christian Krause. No review.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/math/package.scala | 58 |
1 files changed, 48 insertions, 10 deletions
diff --git a/src/library/scala/math/package.scala b/src/library/scala/math/package.scala index 255955be67..9e90b77fc6 100644 --- a/src/library/scala/math/package.scala +++ b/src/library/scala/math/package.scala @@ -9,22 +9,60 @@ package scala /** The package object `scala.math` contains methods for performing basic - * numeric operations such as the elementary exponential, logarithm, - * square root, and trigonometric functions. - */ - + * numeric operations such as elementary exponential, logarithmic, root and + * trigonometric functions. + */ package object math extends MathCommon { - // These are new in 2.8, so they don't belong in the deprecated scala.Math. - def log10(x: Double): Double = java.lang.Math.log10(x) + // ----------------------------------------------------------------------- + // root functions + // ----------------------------------------------------------------------- + + /** Returns the cube root of the given `Double` value. */ def cbrt(x: Double): Double = java.lang.Math.cbrt(x) - def ulp(x: Double): Double = java.lang.Math.ulp(x) - def ulp(x: Float): Float = java.lang.Math.ulp(x) + // ----------------------------------------------------------------------- + // exponential functions + // ----------------------------------------------------------------------- + + /** Returns `exp(x) - 1`. */ + def expm1(x: Double): Double = java.lang.Math.expm1(x) + + // ----------------------------------------------------------------------- + // logarithmic functions + // ----------------------------------------------------------------------- + + /** Returns the natural logarithm of the sum of the given `Double` value and 1. */ + def log1p(x: Double): Double = java.lang.Math.log1p(x) + + /** Returns the base 10 logarithm of the given `Double` value. */ + def log10(x: Double): Double = java.lang.Math.log10(x) + + // ----------------------------------------------------------------------- + // trigonometric functions + // ----------------------------------------------------------------------- + + /** Returns the hyperbolic sine of the given `Double` value. */ def sinh(x: Double): Double = java.lang.Math.sinh(x) + + /** Returns the hyperbolic cosine of the given `Double` value. */ def cosh(x: Double): Double = java.lang.Math.cosh(x) + + /** Returns the hyperbolic tangent of the given `Double` value. */ def tanh(x: Double):Double = java.lang.Math.tanh(x) + + // ----------------------------------------------------------------------- + // miscellaneous functions + // ----------------------------------------------------------------------- + + /** Returns the square root of the sum of the squares of both given `Double` + * values without intermediate underflow or overflow. + */ def hypot(x: Double, y: Double): Double = java.lang.Math.hypot(x, y) - def expm1(x: Double): Double = java.lang.Math.expm1(x) - def log1p(x: Double): Double = java.lang.Math.log1p(x) + + /** Returns the size of an ulp of the given `Double` value. */ + def ulp(x: Double): Double = java.lang.Math.ulp(x) + + /** Returns the size of an ulp of the given `Float` value. */ + def ulp(x: Float): Float = java.lang.Math.ulp(x) } |