mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
runtime: check for signed zero in printfloat
Fixes #6899 R=golang-dev, r, cshapiro, iant, rsc CC=golang-dev https://golang.org/cl/38120043
This commit is contained in:
parent
6ede93498c
commit
f574726f16
|
@ -236,7 +236,10 @@ runtime·printfloat(float64 v)
|
|||
n = 7; // digits printed
|
||||
e = 0; // exp
|
||||
s = 0; // sign
|
||||
if(v != 0) {
|
||||
if(v == 0) {
|
||||
if(1/v == runtime·neginf)
|
||||
s = 1;
|
||||
} else {
|
||||
// sign
|
||||
if(v < 0) {
|
||||
v = -v;
|
||||
|
|
13
test/fixedbugs/issue6899.go
Normal file
13
test/fixedbugs/issue6899.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
// cmpout
|
||||
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "math"
|
||||
|
||||
func main() {
|
||||
println(math.Copysign(0, -1))
|
||||
}
|
1
test/fixedbugs/issue6899.out
Normal file
1
test/fixedbugs/issue6899.out
Normal file
|
@ -0,0 +1 @@
|
|||
-0.000000e+000
|
Loading…
Reference in a new issue