This page is no longer maintained — Please continue to the home page at www.scala-lang.org

scala math

3 replies
odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.

Hi Paul,

Lukas pointed me to the right way of dealing with scala.Math/scala.match:

package object scala {
@deprecated val Math = scala.math.`package`
}

Easy, no? I'm ging to check that in, after having transferred the
deprecated members of scala.Math to scala.math.`package`.

Cheers

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: scala math

On Fri, Dec 11, 2009 at 03:52:52PM +0100, martin odersky wrote:
> Lukas pointed me to the right way of dealing with scala.Math/scala.match:
>
> package object scala {
> @deprecated val Math = scala.math.`package`
> }

I checked it in that way in r19684:

https://lampsvn.epfl.ch/trac/scala/changeset/19684

However I undid it because I didn't want all the new functions I added
to scala.math to also appear in a deprecated form in the Math object.
These are all new in 2.8:

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 conversely, I didn't want the math package object to have to hold
deprecated values which need only exist in scala.Math:

@deprecated("Use scala.Byte.MinValue instead")
val MIN_BYTE = java.lang.Byte.MIN_VALUE

@deprecated("Use scala.Byte.MaxValue instead")
val MAX_BYTE = java.lang.Byte.MAX_VALUE

Etc. etc. So I wanted to put the common elements in a trait, but
couldn't do that before because it didn't work with package objects.
But now that could be done.

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: scala math

Ah, OK I understand better. I would not mind so much about the
@deprecated things. I think either way is OK.

Cheers

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: scala math

On Fri, Dec 11, 2009 at 04:41:48PM +0100, martin odersky wrote:
> Ah, OK I understand better. I would not mind so much about the
> @deprecated things. I think either way is OK.

I'd really prefer to limit the scope of deprecation as much as possible,
so I'll field this one if it's all the same to you.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland