diff options
author | Koki Fushimi <paalon1936@gmail.com> | 2018-06-06 00:15:04 +0900 |
---|---|---|
committer | Varriount <Varriount@users.noreply.github.com> | 2018-06-05 11:15:04 -0400 |
commit | 959b6354c126159e5a59c3a021e472380d04e088 (patch) | |
tree | 8fd604f91715bba3c79add8876a6b3baaf0dd917 /lib/pure | |
parent | 230692a22f92ed010e04ba8c1b2b95f86350f1a5 (diff) | |
download | Nim-959b6354c126159e5a59c3a021e472380d04e088.tar.gz |
Rename tgamma to gamma (#7929)
* Rename tgamma to gamma * set the deprecating version 0.19.0 * update changelog and use description in deprecated pragma
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/math.nim | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 6658b6307..8ea8ee203 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -280,12 +280,18 @@ when not defined(JS): # C proc erfc*(x: float64): float64 {.importc: "erfc", header: "<math.h>".} ## The complementary error function + proc gamma*(x: float32): float32 {.importc: "tgammaf", header: "<math.h>".} + proc gamma*(x: float64): float64 {.importc: "tgamma", header: "<math.h>".} + ## The gamma function + proc tgamma*(x: float32): float32 + {.deprecated: "use gamma instead", importc: "tgammaf", header: "<math.h>".} + proc tgamma*(x: float64): float64 + {.deprecated: "use gamma instead", importc: "tgamma", header: "<math.h>".} + ## The gamma function + ## **Deprecated since version 0.19.0**: Use ``gamma`` instead. proc lgamma*(x: float32): float32 {.importc: "lgammaf", header: "<math.h>".} proc lgamma*(x: float64): float64 {.importc: "lgamma", header: "<math.h>".} ## Natural log of the gamma function - proc tgamma*(x: float32): float32 {.importc: "tgammaf", header: "<math.h>".} - proc tgamma*(x: float64): float64 {.importc: "tgamma", header: "<math.h>".} - ## The gamma function proc floor*(x: float32): float32 {.importc: "floorf", header: "<math.h>".} proc floor*(x: float64): float64 {.importc: "floor", header: "<math.h>".} @@ -557,6 +563,7 @@ when isMainModule and not defined(JS): return sqrt(num) # check gamma function + assert(gamma(5.0) == 24.0) # 4! assert($tgamma(5.0) == $24.0) # 4! assert(lgamma(1.0) == 0.0) # ln(1.0) == 0.0 assert(erf(6.0) > erf(5.0)) |