summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authordom96 <dominikpicheta@googlemail.com>2011-10-31 15:39:01 +0000
committerdom96 <dominikpicheta@googlemail.com>2011-10-31 15:39:01 +0000
commite1a82987af8a394e6bcb7a36c9a298074472db19 (patch)
tree22f47f8d7216bd75193d06c0258bf8c1da741b23 /lib/pure
parent15fcb58e2aff206ac051a6ab9afcacc05ec602c7 (diff)
downloadNim-e1a82987af8a394e6bcb7a36c9a298074472db19.tar.gz
Fixed the tester. Some fixes and additions for the JS backend.
Diffstat (limited to 'lib/pure')
-rwxr-xr-xlib/pure/math.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim
index c44d786b1..972b013c3 100755
--- a/lib/pure/math.nim
+++ b/lib/pure/math.nim
@@ -190,7 +190,7 @@ when not defined(ECMAScript):
 else:  
   proc mathrandom(): float {.importc: "Math.random", nodecl.}
   proc floor*(x: float): float {.importc: "Math.floor", nodecl.}
-  proc random*(max: int): int = return floor(mathrandom() * max)
+  proc random*(max: int): int = return int(floor(mathrandom() * float(max)))
   proc randomize*() = nil
   
   proc sqrt*(x: float): float {.importc: "Math.sqrt", nodecl.}
@@ -204,7 +204,7 @@ else:
   
   proc frexp*(x: float, exponent: var int): float =
     if x == 0.0:
-      exponent = 0.0
+      exponent = 0
       result = 0.0
     elif x < 0.0:
       result = -frexp(-x, exponent)