summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2018-10-31 21:53:40 +0100
committerGitHub <noreply@github.com>2018-10-31 21:53:40 +0100
commitd56312624e23ad830a060ac3733488ce2b69ae70 (patch)
tree3b3c8b94ff14dc725271fb5985c7ef05586ee8ff /lib
parent0059f16dfb2ce916dae69c7fb191e6e5aa8217de (diff)
parent8a1d52fa4853c3e6bbefe8817f4cc2f0de035419 (diff)
downloadNim-d56312624e23ad830a060ac3733488ce2b69ae70.tar.gz
Merge pull request #9586 from b3liever/fix-hypot-js
Fix #9585 hypot in js
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/math.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim
index e2ad626de..ee32772b1 100644
--- a/lib/pure/math.nim
+++ b/lib/pure/math.nim
@@ -479,7 +479,8 @@ when not defined(JS): # C
     ##  (-6.5 mod -2.5) == -1.5
 
 else: # JS
-  proc hypot*[T: float32|float64](x, y: T): T = return sqrt(x*x + y*y)
+  proc hypot*(x, y: float32): float32 {.importc: "Math.hypot", varargs, nodecl.}
+  proc hypot*(x, y: float64): float64 {.importc: "Math.hypot", varargs, nodecl.}
   proc pow*(x, y: float32): float32 {.importC: "Math.pow", nodecl.}
   proc pow*(x, y: float64): float64 {.importc: "Math.pow", nodecl.}
   proc floor*(x: float32): float32 {.importc: "Math.floor", nodecl.}