summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-04-15 09:08:46 +0000
committerpaltherr <paltherr@epfl.ch>2003-04-15 09:08:46 +0000
commitbcad96f5ad3038d556743de0745a29f1de4f9cae (patch)
tree8c6bbb7c82f273f41bf02bcd69c1f9d6d3e60cf0 /sources
parent64861914be35966810b3d3ed5d7cbba75617aecc (diff)
downloadscala-bcad96f5ad3038d556743de0745a29f1de4f9cae.tar.gz
scala-bcad96f5ad3038d556743de0745a29f1de4f9cae.tar.bz2
scala-bcad96f5ad3038d556743de0745a29f1de4f9cae.zip
- Added functions abs
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/Predef.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/sources/scala/Predef.scala b/sources/scala/Predef.scala
index ee28828191..61d6397c59 100644
--- a/sources/scala/Predef.scala
+++ b/sources/scala/Predef.scala
@@ -17,6 +17,11 @@ object Predef {
def error[err](x: String):err = new java.lang.RuntimeException(x).throw;
+ def abs(x: int): int = if (x < 0) -x else x;
+ def abs(x: long): long = if (x < 0) -x else x;
+ def abs(x: float): float = if (x < 0) -x else x;
+ def abs(x: double): double = if (x < 0) -x else x;
+
def try[a](def block: a): Except[a] =
new Except(scala.runtime.ResultOrException.tryBlock(block));