You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a test case: Exp(-740.0) for Exp(x) function, and verify the correctness of Exp(x) with commands:
cd golang/src/math/
../../bin/go test -c
./math.test -test.run TestExp$
Changes are as follow:
diff --git a/src/math/all_test.go b/src/math/all_test.go
index 0412c19..47cf947 100644
--- a/src/math/all_test.go+++ b/src/math/all_test.go@@ -1012,6 +1012,7 @@ var vfexpSC = []float64{
1.48852223e+09,
1.4885222e+09,
1,
+ -7.40e+02, // The input parameters of Exp(x) function
}
var expSC = []float64{
0,
@@ -1023,6 +1024,7 @@ var expSC = []float64{
Inf(1),
Inf(1),
2.718281828459045,
+ 4.2e-322, // The expected result of Exp(-740.0)
}
var vfexp2SC = []float64{
This is a limitation of the algorithm used in the amd64 assembly implementation of Exp (the pure go version we use e.g. for 386 does not have this issue and correctly returns 4.2e-322). AFAIK it's not the only issue the amd64 implementation has. It's much faster than the pure go version, but accuracy-wise it's not as good. It has been like this since forever, anyway, it's not a recent regression.
griesemer
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Mar 28, 2018
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Go version devel +2de98eb Sat Dec 16 23:30:58 2017 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/home/username/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/username/golangworkspace"
GORACE=""
GOROOT="/home/username/golang"
GOTMPDIR=""
GOTOOLDIR="/home/username/golang/pkg/tool/linux_amd64"
GCCGO="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-build362762432=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Add a test case: Exp(-740.0) for Exp(x) function, and verify the correctness of Exp(x) with commands:
cd golang/src/math/
../../bin/go test -c
./math.test -test.run TestExp$
Changes are as follow:
What did you expect to see?
PASS
What did you see instead?
--- FAIL: TestExp (0.00s)
all_test.go:2277: Exp(-740) = 0, want 4.2e-322
FAIL
The text was updated successfully, but these errors were encountered: