Skip to content

math/cmplx: hyperbolic sinh, cosh and tanh give wrong result for Inf input #29320

@kortschak

Description

@kortschak

What version of Go are you using (go version)?

$ go version
go version go1.11.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

Run the code at https://play.golang.org/p/8dz30xSTLdI.

Notice that sinh(inf) and cosh(inf) are inf, and tanh(inf) is 1.

What did you expect to see?

sinh((+Inf+Infi)) -> (+Inf+Infi)
cosh((+Inf+Infi)) -> (+Inf+Infi)
tanh((+Inf+Infi)) -> (1+0i)

What did you see instead?

sinh((+Inf+Infi)) -> (NaN+NaNi)
cosh((+Inf+Infi)) -> (NaN+NaNi)
tanh((+Inf+Infi)) -> (NaN+NaNi)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions