summaryrefslogtreecommitdiff
path: root/test/files/run/t5565.scala
blob: 9ced87ca21a7638a546703fb080f13b004821ac0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import scala.language.reflectiveCalls
import scala.language.implicitConversions

object Test extends App {
  implicit def doubleWithApproxEquals(d: Double) = new {
    def ~==(v: Double, margin: Double = 0.001): Boolean =
      math.abs(d - v) < margin
  }

  assert(math.abs(-4.0) ~== (4.0, 0.001))
  assert(math.abs(-4.0) ~== 4.0)
}