Skip to content

math: Max(NaN, x) may return x instead of NaN (depending on the bit representation of NaN) #9919

@barnex

Description

@barnex

The following code: http://play.golang.org/p/uvj_pmygbE prints math.Max(NaN, 0), where NaN is obtained by either math.NaN() or a/a with a := 0.0.

In the second case, the result is 0 instead of the expected NaN.

This issue is shared by math.Min. However, math.IsNaN works fine for both NaN's.

Tested with go 1.4.2 on linux amd64 and with go 1.4.1 in the playground on nacl amd64p32.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions