diff options
| author | azidar | 2015-07-30 11:50:54 -0700 |
|---|---|---|
| committer | azidar | 2015-07-30 11:50:54 -0700 |
| commit | 9b2f96b8d0b6c7f4e6fefde918d7a335ccd7b7f3 (patch) | |
| tree | 089578809d3ebe63ac5983ddda7fff7a6c00430a /src/main/stanza/ir-utils.stanza | |
| parent | d075e52e86648d345e89ae4a4c75fd3a98cc2788 (diff) | |
Updated lots of tests so they pass. Found one bug in expand whens
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
| -rw-r--r-- | src/main/stanza/ir-utils.stanza | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza index 0118c73b..93dc0d79 100644 --- a/src/main/stanza/ir-utils.stanza +++ b/src/main/stanza/ir-utils.stanza @@ -86,9 +86,13 @@ public defn abs (x:Long) -> Long : if x < to-long(0) : to-long(0) - x else : x -;public defn to-int (x:Long) -> Int : - ;if x > to-long(2147483647) or x < to-long(–2147483648) : error("Long too big to convert to Int") - ;else : x + 0 +public defn max (x:Long,y:Long) -> Long : + if x < y : y + else : x + +public defn to-int (x:Long) -> Int : + if x > to-long(2147483647) or x < to-long(-2147483648) : error("Long too big to convert to Int") + else : to-int(to-string(x)) ;============== PRINTERS =================================== |
