```scala
      if (expma == scala.Double.PositiveInfinity) //Infinity / Infinity
        -1.0
      else {
        val expa = exp(a)
        val ret = expma / (expa + expma)
        1.0 - (2.0 * ret)
      }
```