diff options
author | Koki Fushimi <paalon1936@gmail.com> | 2018-06-04 15:03:08 +0900 |
---|---|---|
committer | Koki Fushimi <paalon1936@gmail.com> | 2018-06-04 15:03:08 +0900 |
commit | d7913419d7a7626ffa774529ae7e20b360d6257e (patch) | |
tree | 4ee632a5118ee01861c9e54aaa27a28179608d37 | |
parent | 91765e583da91b8288e18e74d4196713dc2ede18 (diff) | |
download | Nim-d7913419d7a7626ffa774529ae7e20b360d6257e.tar.gz |
Add log proc for base b of x
-rw-r--r-- | lib/pure/math.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 6be19a339..6969b55e3 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -141,6 +141,8 @@ when not defined(JS): # C proc ln*(x: float32): float32 {.importc: "logf", header: "<math.h>".} proc ln*(x: float64): float64 {.importc: "log", header: "<math.h>".} ## Computes the natural log of `x` + proc log*(b, x: float32): float32 = ln(x) / ln(b) + ## Computes the logarithm base ``b`` of ``x`` proc log10*(x: float32): float32 {.importc: "log10f", header: "<math.h>".} proc log10*(x: float64): float64 {.importc: "log10", header: "<math.h>".} ## Computes the common logarithm (base 10) of `x` @@ -372,7 +374,7 @@ when not defined(JS): # C proc `mod`*(x, y: float32): float32 {.importc: "fmodf", header: "<math.h>".} proc `mod`*(x, y: float64): float64 {.importc: "fmod", header: "<math.h>".} - ## Computes the modulo operation for float operators. + ## Computes the modulo operation for float operators. else: # JS proc hypot*[T: float32|float64](x, y: T): T = return sqrt(x*x + y*y) proc pow*(x, y: float32): float32 {.importC: "Math.pow", nodecl.} |