diff options
| author | Mohit Agarwal <mohit@sdf.org> | 2016-10-18 14:00:30 +0530 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2016-10-18 22:12:03 +0000 |
| commit | 7eed848a178cbecae7131434eed1eaab81709a85 (patch) | |
| tree | 93ebc99f60996c2660f59d5dd3a69b796dbe575b /src/testing/testing.go | |
| parent | 97b04152bc3d9df1155bc97d9e6095f69b6882c7 (diff) | |
| download | go-7eed848a178cbecae7131434eed1eaab81709a85.tar.xz | |
math: speed up Gamma(+Inf)
Add special case for Gamma(+∞) which speeds it up:
benchmark old ns/op new ns/op delta
BenchmarkGamma-4 14.5 7.44 -48.69%
The documentation for math.Gamma already specifies it as a special
case:
Gamma(+Inf) = +Inf
The original C code that has been used as the reference implementation
(as mentioned in the comments in gamma.go) also treats Gamma(+∞) as a
special case:
if( x == INFINITY )
return(x);
Change-Id: Idac36e19192b440475aec0796faa2d2c7f8abe0b
Reviewed-on: https://go-review.googlesource.com/31370
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/testing/testing.go')
0 files changed, 0 insertions, 0 deletions
