Skip to content

gollvm/gofrontend: complex division produces wrong results. #52808

@xqq0629

Description

@xqq0629

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

$ go version

gollvm

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
Debian

Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz (Cascade Lake)

What did you do?

error case:

package main

import (
    "fmt"
    "math"
)

var (
    nan     = math.NaN()
    inf     = math.Inf(1)
    zero    = 0.0
)

func main() {
    var val complex128 = complex(zero, zero)
    var val1 complex128 = complex(nan, inf)

    res1 := val / val1
    fmt.Println(res1)
}

What did you expect to see?

(0+0i)
According to ISO/IEC 9899:1999 (E), (0+0i) / (NaN+Infi) = (0+0i)

What did you see instead?

(NaN+NaNi)

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions