Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: inconsistent return value of math.Acos (or inconsistent printing of floats) #23646

Closed
tamird opened this issue Jan 31, 2018 · 1 comment
Milestone

Comments

@tamird
Copy link
Contributor

tamird commented Jan 31, 2018

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

go version go1.10rc1 gccgo (GCC) 8.0.1 20180131 (experimental) linux/amd64

Does this issue reproduce with the latest release?

N/A

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tduberstein/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tduberstein/local/go"
GORACE=""
GOROOT="/home/tduberstein/local/gcc/gcc"
GOTMPDIR=""
GOTOOLDIR="/home/tduberstein/local/gcc/gcc/libexec/gcc/x86_64-pc-linux-gnu/8.0.1"
GCCGO="/home/tduberstein/local/gcc/gcc/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build297122770=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

package main

import (
        "fmt"
        "math"
)

func main() {
        fmt.Println(math.Acos(0.5))
}

What did you expect to see?

1.0471975511965976

What did you see instead?

1.0471975511965979

@gopherbot gopherbot added this to the Gccgo milestone Jan 31, 2018
@ianlancetaylor
Copy link
Member

The gccgo implementation of math.Acos simply calls the implementation in the underlying C library. As you can see, this can produce very slightly different results. The math package is documented as not promising to produce bit-identical results across all systems. Closing as working as expected.

@golang golang locked and limited conversation to collaborators Jan 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants