Skip to content

math: Gamma(x) special cases are wrong #2977

@robpike

Description

@robpike
from -1 through -33 the answer is always +Inf; after that it oscillates between -Inf and
+Inf. i'm not sure it matters but it doesn't seem right.

this is the Go 1 behavior on Feb 10, 2012.

package main

import "fmt"
import "math"

func main() {
    for i := -1; i > -100; i-- { fmt.Println(i, ":",math.Gamma(float64(i))) }
}

-1 : +Inf
-2 : +Inf
-3 : +Inf
-4 : +Inf
-5 : +Inf
-6 : +Inf
-7 : +Inf
-8 : +Inf
-9 : +Inf
-10 : +Inf
-11 : +Inf
-12 : +Inf
-13 : +Inf
-14 : +Inf
-15 : +Inf
-16 : +Inf
-17 : +Inf
-18 : +Inf
-19 : +Inf
-20 : +Inf
-21 : +Inf
-22 : +Inf
-23 : +Inf
-24 : +Inf
-25 : +Inf
-26 : +Inf
-27 : +Inf
-28 : +Inf
-29 : +Inf
-30 : +Inf
-31 : +Inf
-32 : +Inf
-33 : +Inf
-34 : -Inf
-35 : +Inf
-36 : -Inf
-37 : +Inf
-38 : -Inf
-39 : +Inf
-40 : -Inf

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions