Skip to content

cmd/compile, runtime: complex (-1+0i)/0.0 results in +inf #14644

@martisch

Description

@martisch

at least go1.4, go 1.6, go tip

found this writing fmt tests for float formatting.
But i do not think this time its a formatting error:

https://play.golang.org/p/UonwOD_TT3

package main
func main() {
    v := -1+0i
    print(real(v)/0.0) // float 0 division
    print(" vs ")
    print(real(v/0.0)) // complex 0 division
    print("\n")
}

Output:

-Inf vs +Inf

would have expected -Inf for the complex case too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions