/* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ // $Id$ package scala /** The object Math contains methods for performing basic numeric * operations such as the elementary exponential, logarithm, square root, and * trigonometric functions. */ object Math { /** The smalles possible value for scala.Byte. */ val MIN_BYTE = java.lang.Byte.MIN_VALUE /** The greatest possible value for scala.Byte. */ val MAX_BYTE = java.lang.Byte.MAX_VALUE /** The smalles possible value for scala.Short. */ val MIN_SHORT = java.lang.Short.MIN_VALUE /** The greatest possible value for scala.Short. */ val MAX_SHORT = java.lang.Short.MAX_VALUE /** The smalles possible value for scala.Char. */ val MIN_CHAR = java.lang.Character.MIN_VALUE /** The greatest possible value for scala.Char. */ val MAX_CHAR = java.lang.Character.MAX_VALUE /** The smalles possible value for scala.Int. */ val MIN_INT = java.lang.Integer.MIN_VALUE /** The greatest possible value for scala.Int. */ val MAX_INT = java.lang.Integer.MAX_VALUE /** The smalles possible value for scala.Long. */ val MIN_LONG = java.lang.Long.MIN_VALUE /** The greatest possible value for scala.Long. */ val MAX_LONG = java.lang.Long.MAX_VALUE /** The smalles possible value for scala.Float. */ val MIN_FLOAT = -java.lang.Float.MAX_VALUE /** The smalles difference between two values of scala.Float. */ val EPS_FLOAT = java.lang.Float.MIN_VALUE /** The greatest possible value for scala.Float. */ val MAX_FLOAT = java.lang.Float.MAX_VALUE /** A value of type scala.Float that represents no number. */ val NaN_FLOAT = java.lang.Float.NaN /** Negative infinity of type scala.Float*/ val NEG_INF_FLOAT = java.lang.Float.NEGATIVE_INFINITY /** Positive infinity of type scala.Float*/ val POS_INF_FLOAT = java.lang.Float.POSITIVE_INFINITY /** The smalles possible value for scala.Double. */ val MIN_DOUBLE = -java.lang.Double.MAX_VALUE /** The smalles difference between two values of scala.Double. */ val EPS_DOUBLE = java.lang.Double.MIN_VALUE /** The greatest possible value for scala.Double. */ val MAX_DOUBLE = java.lang.Double.MAX_VALUE /** A value of type scala.Double that represents no number. */ val NaN_DOUBLE = java.lang.Double.NaN /** Negative infinity of type scala.Double*/ val NEG_INF_DOUBLE = java.lang.Double.NEGATIVE_INFINITY /** Positive infinity of type scala.Double*/ val POS_INF_DOUBLE = java.lang.Double.POSITIVE_INFINITY /** The double value that is closer than any other to * e, the base of the natural logarithms. */ val E = java.lang.Math.E /** The double value that is closer than any other to * pi, the ratio of the circumference of a circle to its * diameter. */ val Pi = java.lang.Math.PI /** Returns a double value with a positive sign, greater than * or equal to 0.0 and less than 1.0. */ 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 x 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 x in degrees. */ def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x) /** Returns Euler's number e raised to the power of a * double value. * * @param x the exponent to raise e to. * @return the value ea, where e * 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 double value that is closest in value to the * argument and is equal to a mathematical integer. * * @param x a double 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 (x, y) to polar * (r, theta). * * @param x the ordinate coordinate * @param y the abscissa coordinate * @return the theta component of the point (r, theta) * in polar coordinates that corresponds to the point * (x, y) in Cartesian coordinates. */ def atan2(x: Double, y: Double): Double = java.lang.Math.atan2(x, y) /** 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 xy. */ def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y) /** Returns the closest long to the argument. * * @param x a floating-point value to be rounded to a long. * @return the value of the argument rounded to the nearest * long 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) // from Java 1.5 // def log10(x: Double): Double = java.lang.Math.log10(x) // 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) // def signum(x: Double): Double = java.lang.Math.signum(x) // def signum(x: Float): Float = java.lang.Math.signum(x) // def sinh(x: Double): Double = java.lang.Math.sinh(x) // def cosh(x: Double): Double = java.lang.Math.cosh(x) // def tanh(x: Double):Double = java.lang.Math.tanh(x) // 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) }