diff options
author | Araq <rumpf_a@web.de> | 2011-02-12 19:24:20 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-02-12 19:24:20 +0100 |
commit | 5b28d08203ba36e84c8e381761db182c0393d07f (patch) | |
tree | 9f1fdcb65d8617b65672305327a208bb030405c7 /lib/pure/math.nim | |
parent | 27dc54cbda0beffe8bca36d9cc59cccaf0b2d30f (diff) | |
download | Nim-5b28d08203ba36e84c8e381761db182c0393d07f.tar.gz |
non-nil AST; continue after errors for IDE support
Diffstat (limited to 'lib/pure/math.nim')
-rwxr-xr-x | lib/pure/math.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim index dc6133901..c44d786b1 100755 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -185,11 +185,12 @@ when not defined(ECMAScript): proc random(max: int): int = return int(rand()) mod max proc trunc*(x: float): float {.importc: "trunc", nodecl.} + proc floor*(x: float): float {.importc: "floor", nodecl.} else: proc mathrandom(): float {.importc: "Math.random", nodecl.} - proc mathfloor(x: float): float {.importc: "Math.floor", nodecl.} - proc random*(max: int): int = return mathfloor(mathrandom() * max) + proc floor*(x: float): float {.importc: "Math.floor", nodecl.} + proc random*(max: int): int = return floor(mathrandom() * max) proc randomize*() = nil proc sqrt*(x: float): float {.importc: "Math.sqrt", nodecl.} @@ -208,7 +209,7 @@ else: elif x < 0.0: result = -frexp(-x, exponent) else: - var ex = mathfloor(log2(x)) + var ex = floor(log2(x)) exponent = round(ex) result = x / pow(2.0, ex) @@ -227,7 +228,6 @@ else: var y = exp(2.0*x) return (y-1.0)/(y+1.0) - type TRunningStat* = object ## an accumulator for statistical data n*: int ## number of pushed data |