summaryrefslogtreecommitdiff
path: root/test/files/run/Course-2002-10.scala
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2003-11-11 16:02:24 +0000
committermihaylov <mihaylov@epfl.ch>2003-11-11 16:02:24 +0000
commit2093f9a082a378b79d888788818aca28487b5ac6 (patch)
treee8eb5e59161ebbf78b89f3a9272aaf429e4f58fa /test/files/run/Course-2002-10.scala
parent18fa82639a51fab27da3ec5b34befb46cff659cb (diff)
downloadscala-2093f9a082a378b79d888788818aca28487b5ac6.tar.gz
scala-2093f9a082a378b79d888788818aca28487b5ac6.tar.bz2
scala-2093f9a082a378b79d888788818aca28487b5ac6.zip
Modified to work for the .NET platform, where p...
Modified to work for the .NET platform, where printout of values of type double may have one more digit of precision (which will be truncated).
Diffstat (limited to 'test/files/run/Course-2002-10.scala')
-rw-r--r--test/files/run/Course-2002-10.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/files/run/Course-2002-10.scala b/test/files/run/Course-2002-10.scala
index 9a292937ca..d75d52e963 100644
--- a/test/files/run/Course-2002-10.scala
+++ b/test/files/run/Course-2002-10.scala
@@ -57,7 +57,9 @@ object M1 {
var pi1 = euler(pi0);
var pi2 = veryGood(pi0, euler);
- def pad(s: String, n: int): String = if (n == 0) s else pad(s + " ", n - 1);
+ def pad(s: String, n: int): String =
+ if (n <= 0) s.substring(0, s.length() + n)
+ else pad(s + " ", n - 1);
def str(d: double) = { val s = d.toString(); pad(s, 18 - s.length()) };
def test = {