Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Dec 9, 2020
1 parent 585f46c commit 69235b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 9 additions & 2 deletions lib/pure/math.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ import std/private/since
# of the standard library!

import bitops, fenv
from std/cmath import nil

when defined(c) or defined(cpp):
#[
Low level wrappers around C math functions.
Consider moving this to a dedicated `std/cmath`.
]#
proc c_isnan*(x: float): bool {.importc: "isnan", header: "<math.h>".}
# a generic like `x: SomeFloat` might work too if this is implemented via a C macro.

func binom*(n, k: int): int =
## Computes the `binomial coefficient <https://en.wikipedia.org/wiki/Binomial_coefficient>`_.
Expand Down Expand Up @@ -145,7 +152,7 @@ func isNaN*(x: SomeFloat): bool {.inline, since: (1,5,1).} =
when nimvm: fn()
else:
when defined(js): fn()
else: result = cmath.isnan(x)
else: result = c_isnan(x)

func classify*(x: float): FloatClass =
## Classifies a floating point value.
Expand Down
6 changes: 0 additions & 6 deletions lib/std/cmath.nim

This file was deleted.

0 comments on commit 69235b4

Please sign in to comment.