Rename tgamma to gamma (#7929)

* Rename tgamma to gamma

* set the deprecating version  0.19.0

* update changelog and use description in deprecated pragma
This commit is contained in:
Koki Fushimi 2018-06-06 00:15:04 +09:00 • committed by Varriount
commit 959b6354c1
2 changed files with 11 additions and 3 deletions

View file

@ -87,6 +87,7 @@
- Added the parameter ``val`` for the ``CritBitTree[int].inc`` proc.
- An exception raised from ``test`` block of ``unittest`` now shows its type in
the error message
- The proc ``tgamma`` was renamed to ``gamma``. ``tgamma`` is deprecated.
### Language additions

View file

@ -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))