summaryrefslogtreecommitdiff
path: root/test/pos/sqrt.scala
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-07-18 11:29:07 +0000
committerpaltherr <paltherr@epfl.ch>2003-07-18 11:29:07 +0000
commit30309b2ba2d8bfa6fb656cd760f6315581204d1d (patch)
tree816b6f68cbf63c7f255dab18939623cb6ec0248a /test/pos/sqrt.scala
parent5f77ce3a39f276eea29df1b09926553364d80e1d (diff)
downloadscala-30309b2ba2d8bfa6fb656cd760f6315581204d1d.tar.gz
scala-30309b2ba2d8bfa6fb656cd760f6315581204d1d.tar.bz2
scala-30309b2ba2d8bfa6fb656cd760f6315581204d1d.zip
- Removed duplicates
Diffstat (limited to 'test/pos/sqrt.scala')
-rw-r--r--test/pos/sqrt.scala21
1 files changed, 0 insertions, 21 deletions
diff --git a/test/pos/sqrt.scala b/test/pos/sqrt.scala
deleted file mode 100644
index 5ad1718619..0000000000
--- a/test/pos/sqrt.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-object test {
-
- def abs(x: Double) = if (x >= 0) x else 0 - x;
-
-
- def square(x: Double) = x * x;
-
- def sqrt(x: Double) = {
- def sqrtIter(guess: Double): Double =
- if (isGoodEnough(guess)) guess
- else sqrtIter(improve(guess));
-
- def improve(guess: Double) =
- (guess + x / guess) / 2;
-
- def isGoodEnough(guess: Double) =
- abs(square(guess) - x) < 0.001;
-
- sqrtIter(1.0);
- }
-} \ No newline at end of file