summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/scala-compiler.jar.desired.sha12
-rw-r--r--lib/scala-library-src.jar.desired.sha12
-rw-r--r--lib/scala-library.jar.desired.sha12
-rw-r--r--src/library/scala/Math.scala139
-rw-r--r--src/library/scala/MathCommon.scala144
-rw-r--r--src/library/scala/math/package.scala130
6 files changed, 151 insertions, 268 deletions
diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1
index 2e408e7b30..2c79854df5 100644
--- a/lib/scala-compiler.jar.desired.sha1
+++ b/lib/scala-compiler.jar.desired.sha1
@@ -1 +1 @@
-ffd0a45a376f604415980cf8891d780edc327c8f ?scala-compiler.jar
+0ab0a9ff4350a7bfc7bbf89d5cab73c9875fae27 ?scala-compiler.jar
diff --git a/lib/scala-library-src.jar.desired.sha1 b/lib/scala-library-src.jar.desired.sha1
index 639779719e..a93fbbf4ea 100644
--- a/lib/scala-library-src.jar.desired.sha1
+++ b/lib/scala-library-src.jar.desired.sha1
@@ -1 +1 @@
-4b4cf49e7d50ec49a0a5c1762f7213c41b8149e2 ?scala-library-src.jar
+a62961db6716add97af1095eba07d1f8405cc293 ?scala-library-src.jar
diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1
index d130f5a43f..51969e7802 100644
--- a/lib/scala-library.jar.desired.sha1
+++ b/lib/scala-library.jar.desired.sha1
@@ -1 +1 @@
-a3dc8a4cf67a2fd2096cd42ab5ee34ea7a45c0d4 ?scala-library.jar
+5b5ef44fef590bf98e3b5c0cade8b333d0f629e3 ?scala-library.jar
diff --git a/src/library/scala/Math.scala b/src/library/scala/Math.scala
index 6a9fcc029a..3c11958053 100644
--- a/src/library/scala/Math.scala
+++ b/src/library/scala/Math.scala
@@ -15,7 +15,7 @@ package scala
* trigonometric functions.
*/
@deprecated("use scala.math package instead")
-object Math {
+object Math extends MathCommon {
@deprecated("Use scala.Byte.MinValue instead")
val MIN_BYTE = java.lang.Byte.MIN_VALUE
@@ -93,139 +93,4 @@ object Math {
/** Positive infinity of type <a href="Double.html" target="_self">scala.Double</a>. */
@deprecated("Use scala.Double.PositiveInfinity instead")
val POS_INF_DOUBLE = java.lang.Double.POSITIVE_INFINITY
-
- /** The code from here down is cut/pasted from the math package object.
- * It should properly be in a shared trait but as of this writing
- * inherited members in package objects are not visible.
- */
-
- /*******************************************************************/
-
- /** The <code>double</code> value that is closer than any other to
- * <code>e</code>, the base of the natural logarithms.
- */
- val E = java.lang.Math.E
-
- /** The <code>double</code> value that is closer than any other to
- * <code>pi</code>, the ratio of the circumference of a circle to its
- * diameter.
- */
- val Pi = java.lang.Math.PI
-
- /** Returns a <code>double</code> value with a positive sign, greater than
- * or equal to <code>0.0</code> and less than <code>1.0</code>.
- */
- def random: Double = java.lang.Math.random()
-
- def sin(x: Double): Double = java.lang.Math.sin(x)
- def cos(x: Double): Double = java.lang.Math.cos(x)
- def tan(x: Double): Double = java.lang.Math.tan(x)
- def asin(x: Double): Double = java.lang.Math.asin(x)
- def acos(x: Double): Double = java.lang.Math.acos(x)
- def atan(x: Double): Double = java.lang.Math.atan(x)
-
- /** Converts an angle measured in degrees to an approximately equivalent
- * angle measured in radians.
- *
- * @param x an angle, in degrees
- * @return the measurement of the angle <code>x</code> in radians.
- */
- def toRadians(x: Double): Double = java.lang.Math.toRadians(x)
-
- /** Converts an angle measured in radians to an approximately equivalent
- * angle measured in degrees.
- *
- * @param x angle, in radians
- * @return the measurement of the angle <code>x</code> in degrees.
- */
- def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x)
-
- /** Returns Euler's number <code>e</code> raised to the power of a
- * <code>double</code> value.
- *
- * @param x the exponent to raise <code>e</code> to.
- * @return the value <code>e<sup>a</sup></code>, where <code>e</code>
- * is the base of the natural logarithms.
- */
- def exp(x: Double): Double = java.lang.Math.exp(x)
- def log(x: Double): Double = java.lang.Math.log(x)
- def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
- def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
-
- def ceil(x: Double): Double = java.lang.Math.ceil(x)
- def floor(x: Double): Double = java.lang.Math.floor(x)
-
- /** Returns the <code>double</code> value that is closest in value to the
- * argument and is equal to a mathematical integer.
- *
- * @param x a <code>double</code> value
- * @return the closest floating-point value to a that is equal to a
- * mathematical integer.
- */
- def rint(x: Double): Double = java.lang.Math.rint(x)
-
- /** Converts rectangular coordinates <code>(x, y)</code> to polar
- * <code>(r, theta)</code>.
- *
- * @param x the ordinate coordinate
- * @param y the abscissa coordinate
- * @return the <em>theta</em> component of the point <code>(r, theta)</code>
- * in polar coordinates that corresponds to the point
- * <code>(x, y)</code> in Cartesian coordinates.
- */
- def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x)
-
- /** Returns the value of the first argument raised to the power of the
- * second argument.
- *
- * @param x the base.
- * @param y the exponent.
- * @return the value <code>x<sup>y</sup></code>.
- */
- def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
-
- /** Returns the closest <code>long</code> to the argument.
- *
- * @param x a floating-point value to be rounded to a <code>long</code>.
- * @return the value of the argument rounded to the nearest
- * <code>long</code> value.
- */
- def round(x: Float): Int = java.lang.Math.round(x)
- def round(x: Double): Long = java.lang.Math.round(x)
- def abs(x: Int): Int = java.lang.Math.abs(x)
- def abs(x: Long): Long = java.lang.Math.abs(x)
- def abs(x: Float): Float = java.lang.Math.abs(x)
- def abs(x: Double): Double = java.lang.Math.abs(x)
-
- def max(x: Int, y: Int): Int = java.lang.Math.max(x, y)
- def max(x: Long, y: Long): Long = java.lang.Math.max(x, y)
- def max(x: Float, y: Float): Float = java.lang.Math.max(x, y)
- def max(x: Double, y: Double): Double = java.lang.Math.max(x, y)
-
- def min(x: Int, y: Int): Int = java.lang.Math.min(x, y)
- def min(x: Long, y: Long): Long = java.lang.Math.min(x, y)
- def min(x: Float, y: Float): Float = java.lang.Math.min(x, y)
- def min(x: Double, y: Double): Double = java.lang.Math.min(x, y)
-
- def signum(x: Double): Double =
- if (x == 0d) 0d
- else if (x < 0) -1.0
- else if (x > 0) 1.0
- else x // NaN
-
- def signum(x: Float): Float =
- if (x == 0f) 0f
- else if (x < 0) -1.0f
- else if (x > 0) 1.0f
- else x // NaN
-
- def signum(x: Long): Long =
- if (x == 0l) 0l
- else if (x < 0) -1l
- else 1l
-
- def signum(x: Int): Int =
- if (x == 0) 0
- else if (x < 0) -1
- else 1
-}
+} \ No newline at end of file
diff --git a/src/library/scala/MathCommon.scala b/src/library/scala/MathCommon.scala
new file mode 100644
index 0000000000..480f7e1913
--- /dev/null
+++ b/src/library/scala/MathCommon.scala
@@ -0,0 +1,144 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
+package scala
+
+/** Common code between the deprecated scala.Math object and
+ * the scala.math package object.
+ */
+private[scala] trait MathCommon {
+ /** The <code>double</code> value that is closer than any other to
+ * <code>e</code>, the base of the natural logarithms.
+ */
+ val E = java.lang.Math.E
+
+ /** The <code>double</code> value that is closer than any other to
+ * <code>pi</code>, the ratio of the circumference of a circle to its
+ * diameter.
+ */
+ val Pi = java.lang.Math.PI
+
+ /** Returns a <code>double</code> value with a positive sign, greater than
+ * or equal to <code>0.0</code> and less than <code>1.0</code>.
+ */
+ def random: Double = java.lang.Math.random()
+
+ def sin(x: Double): Double = java.lang.Math.sin(x)
+ def cos(x: Double): Double = java.lang.Math.cos(x)
+ def tan(x: Double): Double = java.lang.Math.tan(x)
+ def asin(x: Double): Double = java.lang.Math.asin(x)
+ def acos(x: Double): Double = java.lang.Math.acos(x)
+ def atan(x: Double): Double = java.lang.Math.atan(x)
+
+ /** Converts an angle measured in degrees to an approximately equivalent
+ * angle measured in radians.
+ *
+ * @param x an angle, in degrees
+ * @return the measurement of the angle <code>x</code> in radians.
+ */
+ def toRadians(x: Double): Double = java.lang.Math.toRadians(x)
+
+ /** Converts an angle measured in radians to an approximately equivalent
+ * angle measured in degrees.
+ *
+ * @param x angle, in radians
+ * @return the measurement of the angle <code>x</code> in degrees.
+ */
+ def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x)
+
+ /** Returns Euler's number <code>e</code> raised to the power of a
+ * <code>double</code> value.
+ *
+ * @param x the exponent to raise <code>e</code> to.
+ * @return the value <code>e<sup>a</sup></code>, where <code>e</code>
+ * is the base of the natural logarithms.
+ */
+ def exp(x: Double): Double = java.lang.Math.exp(x)
+ def log(x: Double): Double = java.lang.Math.log(x)
+ def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
+ def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
+
+ def ceil(x: Double): Double = java.lang.Math.ceil(x)
+ def floor(x: Double): Double = java.lang.Math.floor(x)
+
+ /** Returns the <code>double</code> value that is closest in value to the
+ * argument and is equal to a mathematical integer.
+ *
+ * @param x a <code>double</code> value
+ * @return the closest floating-point value to a that is equal to a
+ * mathematical integer.
+ */
+ def rint(x: Double): Double = java.lang.Math.rint(x)
+
+ /** Converts rectangular coordinates <code>(x, y)</code> to polar
+ * <code>(r, theta)</code>.
+ *
+ * @param x the ordinate coordinate
+ * @param y the abscissa coordinate
+ * @return the <em>theta</em> component of the point <code>(r, theta)</code>
+ * in polar coordinates that corresponds to the point
+ * <code>(x, y)</code> in Cartesian coordinates.
+ */
+ def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x)
+
+ /** Returns the value of the first argument raised to the power of the
+ * second argument.
+ *
+ * @param x the base.
+ * @param y the exponent.
+ * @return the value <code>x<sup>y</sup></code>.
+ */
+ def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
+
+ /** Returns the closest <code>long</code> to the argument.
+ *
+ * @param x a floating-point value to be rounded to a <code>long</code>.
+ * @return the value of the argument rounded to the nearest
+ * <code>long</code> value.
+ */
+ def round(x: Float): Int = java.lang.Math.round(x)
+ def round(x: Double): Long = java.lang.Math.round(x)
+ def abs(x: Int): Int = java.lang.Math.abs(x)
+ def abs(x: Long): Long = java.lang.Math.abs(x)
+ def abs(x: Float): Float = java.lang.Math.abs(x)
+ def abs(x: Double): Double = java.lang.Math.abs(x)
+
+ def max(x: Int, y: Int): Int = java.lang.Math.max(x, y)
+ def max(x: Long, y: Long): Long = java.lang.Math.max(x, y)
+ def max(x: Float, y: Float): Float = java.lang.Math.max(x, y)
+ def max(x: Double, y: Double): Double = java.lang.Math.max(x, y)
+
+ def min(x: Int, y: Int): Int = java.lang.Math.min(x, y)
+ def min(x: Long, y: Long): Long = java.lang.Math.min(x, y)
+ def min(x: Float, y: Float): Float = java.lang.Math.min(x, y)
+ def min(x: Double, y: Double): Double = java.lang.Math.min(x, y)
+
+ def signum(x: Double): Double =
+ if (x == 0d) 0d
+ else if (x < 0) -1.0
+ else if (x > 0) 1.0
+ else x // NaN
+
+ def signum(x: Float): Float =
+ if (x == 0f) 0f
+ else if (x < 0) -1.0f
+ else if (x > 0) 1.0f
+ else x // NaN
+
+ def signum(x: Long): Long =
+ if (x == 0l) 0l
+ else if (x < 0) -1l
+ else 1l
+
+ def signum(x: Int): Int =
+ if (x == 0) 0
+ else if (x < 0) -1
+ else 1
+}
diff --git a/src/library/scala/math/package.scala b/src/library/scala/math/package.scala
index 0337b70c73..3c62537f64 100644
--- a/src/library/scala/math/package.scala
+++ b/src/library/scala/math/package.scala
@@ -13,134 +13,8 @@ package scala
* trigonometric functions.
*/
-package object math {
- /** The <code>double</code> value that is closer than any other to
- * <code>e</code>, the base of the natural logarithms.
- */
- val E = java.lang.Math.E
-
- /** The <code>double</code> value that is closer than any other to
- * <code>pi</code>, the ratio of the circumference of a circle to its
- * diameter.
- */
- val Pi = java.lang.Math.PI
-
- /** Returns a <code>double</code> value with a positive sign, greater than
- * or equal to <code>0.0</code> and less than <code>1.0</code>.
- */
- def random: Double = java.lang.Math.random()
-
- def sin(x: Double): Double = java.lang.Math.sin(x)
- def cos(x: Double): Double = java.lang.Math.cos(x)
- def tan(x: Double): Double = java.lang.Math.tan(x)
- def asin(x: Double): Double = java.lang.Math.asin(x)
- def acos(x: Double): Double = java.lang.Math.acos(x)
- def atan(x: Double): Double = java.lang.Math.atan(x)
-
- /** Converts an angle measured in degrees to an approximately equivalent
- * angle measured in radians.
- *
- * @param x an angle, in degrees
- * @return the measurement of the angle <code>x</code> in radians.
- */
- def toRadians(x: Double): Double = java.lang.Math.toRadians(x)
-
- /** Converts an angle measured in radians to an approximately equivalent
- * angle measured in degrees.
- *
- * @param x angle, in radians
- * @return the measurement of the angle <code>x</code> in degrees.
- */
- def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x)
-
- /** Returns Euler's number <code>e</code> raised to the power of a
- * <code>double</code> value.
- *
- * @param x the exponent to raise <code>e</code> to.
- * @return the value <code>e<sup>a</sup></code>, where <code>e</code>
- * is the base of the natural logarithms.
- */
- def exp(x: Double): Double = java.lang.Math.exp(x)
- def log(x: Double): Double = java.lang.Math.log(x)
- def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
- def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
-
- def ceil(x: Double): Double = java.lang.Math.ceil(x)
- def floor(x: Double): Double = java.lang.Math.floor(x)
-
- /** Returns the <code>double</code> value that is closest in value to the
- * argument and is equal to a mathematical integer.
- *
- * @param x a <code>double</code> value
- * @return the closest floating-point value to a that is equal to a
- * mathematical integer.
- */
- def rint(x: Double): Double = java.lang.Math.rint(x)
-
- /** Converts rectangular coordinates <code>(x, y)</code> to polar
- * <code>(r, theta)</code>.
- *
- * @param x the ordinate coordinate
- * @param y the abscissa coordinate
- * @return the <em>theta</em> component of the point <code>(r, theta)</code>
- * in polar coordinates that corresponds to the point
- * <code>(x, y)</code> in Cartesian coordinates.
- */
- def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x)
-
- /** Returns the value of the first argument raised to the power of the
- * second argument.
- *
- * @param x the base.
- * @param y the exponent.
- * @return the value <code>x<sup>y</sup></code>.
- */
- def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
-
- /** Returns the closest <code>long</code> to the argument.
- *
- * @param x a floating-point value to be rounded to a <code>long</code>.
- * @return the value of the argument rounded to the nearest
- * <code>long</code> value.
- */
- def round(x: Float): Int = java.lang.Math.round(x)
- def round(x: Double): Long = java.lang.Math.round(x)
- def abs(x: Int): Int = java.lang.Math.abs(x)
- def abs(x: Long): Long = java.lang.Math.abs(x)
- def abs(x: Float): Float = java.lang.Math.abs(x)
- def abs(x: Double): Double = java.lang.Math.abs(x)
-
- def max(x: Int, y: Int): Int = java.lang.Math.max(x, y)
- def max(x: Long, y: Long): Long = java.lang.Math.max(x, y)
- def max(x: Float, y: Float): Float = java.lang.Math.max(x, y)
- def max(x: Double, y: Double): Double = java.lang.Math.max(x, y)
-
- def min(x: Int, y: Int): Int = java.lang.Math.min(x, y)
- def min(x: Long, y: Long): Long = java.lang.Math.min(x, y)
- def min(x: Float, y: Float): Float = java.lang.Math.min(x, y)
- def min(x: Double, y: Double): Double = java.lang.Math.min(x, y)
-
- def signum(x: Double): Double =
- if (x == 0d) 0d
- else if (x < 0) -1.0
- else if (x > 0) 1.0
- else x // NaN
-
- def signum(x: Float): Float =
- if (x == 0f) 0f
- else if (x < 0) -1.0f
- else if (x > 0) 1.0f
- else x // NaN
-
- def signum(x: Long): Long =
- if (x == 0l) 0l
- else if (x < 0) -1l
- else 1l
-
- def signum(x: Int): Int =
- if (x == 0) 0
- else if (x < 0) -1
- else 1
+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)
def cbrt(x: Double): Double = java.lang.Math.cbrt(x)