This is a `playground`

to test code. It runs a full `Node.js`

environment and already has all of `npm`

’s 400,000 packages pre-installed, including `gamma`

with all `npm`

packages installed. **Try it out**:

var gamma = require("gamma")

- all documents on RunKit are public
`require()`

any package directly from npm- use arrow functions, classes, template strings, and most of ES6
`await`

any promise instead of using callbacks (example)- create your own embedded
**node.js**snippets

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gamma function in javascript using the lanczos approximation for small values and the spouge approximation for larger values

```
> var gamma = require('gamma')
> gamma(5)
23.999999999999996
> gamma(1.6)
0.8935153492876909
```

var gamma = require('gamma')

Return the gamma function over `z`

. Complex numbers aren't supported, only reals.

Return the natural log of the gamma function for `z`

.

This function is used internally by the spouge approximation to compute large values.

With npm do:

```
npm install gamma
```

Implementation transliterated from the python script on the wikipedia entry for the lanczos approximation.

Spouge approximation from Niggler.

MIT

- package on npmhttps://npmjs.com/package/gamma
- licenseMIT

RunKit is a free, in-browser JavaScript dev environment for prototyping **Node.js** code, with every **npm** package installed. Sign up to share your code.

Sign Up for Free