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

math: exp sometimes returns wrong values on overflow on amd64 #18912

Closed
ALTree opened this issue Feb 3, 2017 · 1 comment
Closed

math: exp sometimes returns wrong values on overflow on amd64 #18912

ALTree opened this issue Feb 3, 2017 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Feb 3, 2017

go version devel +12c58bbf81 Fri Feb 3 06:52:46 2017 +0000 linux/amd64

Documentation says:

Very large values overflow to 0 or +Inf

But that's not always true (at least not when using the assembly implementation on amd64). Example:

package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Println(math.Exp(1.48852223e+09))
	fmt.Println(math.Exp(1.4885222e+09))
	fmt.Println(math.Exp(1.48852e+09))
}

Gives

0.0027127673070219977
2.5385055740655363e-16
+Inf
@ALTree ALTree added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 3, 2017
@ALTree ALTree added this to the Go1.9 milestone Feb 3, 2017
@gopherbot
Copy link

CL https://golang.org/cl/36271 mentions this issue.

@golang golang locked and limited conversation to collaborators Feb 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants