Source
Edit
The auto-rewrite do not seem to work :/
proc expm1(x: float32): float32 {.importc: "expm1f", header: "<math.h>",
...raises: [], tags: [], forbids: [].}
-
Source
Edit
proc expm1(x: float64): float64 {.importc: "expm1", header: "<math.h>",
...raises: [], tags: [], forbids: [].}
-
Compute exp(x) - 1 and avoids catastrophic cancellation if x ~= 0 i.e. if x ~= 0 exp(x) - 1 ~= x but normal float rounding would do exp(0) - 1 = 0 instead.
Source
Edit
proc ln1p(x: float32): float32 {.importc: "log1pf", header: "<math.h>",
...raises: [], tags: [], forbids: [].}
-
Source
Edit
proc ln1p(x: float64): float64 {.importc: "log1p", header: "<math.h>",
...raises: [], tags: [], forbids: [].}
-
Compute ln( 1+x ) and avoids catastrophic cancellation if x << 1 i.e. if x << 1 ln(1+x) ~= x but normal float rounding would do ln(1) = 0 instead.
Source
Edit