- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
scala.math proposals
Mon, 2009-11-23, 15:58
1) I propose to deprecate all the values at the end of this email by
putting them in scala.Math (which is entirely deprecated) and removing
them from the math package object, which being brand new need not have
deprecation baggage. I'm not sure how they came to exist, but they are
all duplicates, and the values they duplicate are a) located in a more
logical place and b) use camel case instead of ALL_CAPS, which looks to
be the scala way for constants. If it's not can we clarify that.
Inconsistency is the worst of all worlds.
In case people don't know the equivalents:
Math.MIN_BYTE is Byte.MinValue
(and etc. for MAX and all other numerics)
The float/double specific values are
Float.{ Epsilon, NaN, PositiveInfinity, NegativeInfinity }
and Double.etc.
2) A number of functions added in java 1.5 have been sitting there
commented out - this stems back to 1.4 supporting days. Can I uncomment
them? If not, can we document the thinking - under what conditions would
we enable them?
// 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 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)
And the values I want to deprecate:
/** The smallest 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 smallest 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 smallest 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 smallest 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 smallest 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 smallest possible value for scala.Float. */
val MIN_FLOAT = -java.lang.Float.MAX_VALUE
/** The smallest 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 smallest possible value for scala.Double. */
val MIN_DOUBLE = -java.lang.Double.MAX_VALUE
/** The smallest 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
On Mon, 2009-11-23 at 06:57 -0800, Paul Phillips wrote:
> b) use camel case instead of ALL_CAPS, which looks to
> be the scala way for constants. If it's not can we clarify that.
I am also curious about this. At some point, I remember that CamelCase
was suggested as an improvement over ALL_CAPS and I _seem_ to recall
that there was agreement. Clarification would be great.
Best,
Ismael