summaryrefslogtreecommitdiff
path: root/src/pkg/math/signbit.go
diff options
context:
space:
mode:
authorCharles L. Dorian <cldorian@gmail.com>2010-04-08 13:24:04 -0700
committerCharles L. Dorian <cldorian@gmail.com>2010-04-08 13:24:04 -0700
commitfa5b34d712d428344020e044494b8cfa7e2e1dc0 (patch)
treea419d22b579059f3968fc45568f48b3c77320fc0 /src/pkg/math/signbit.go
parent0454e1cb72b5359386d28d040c16a27e7167b3bd (diff)
downloadgolang-fa5b34d712d428344020e044494b8cfa7e2e1dc0.tar.gz
math: atan2 special cases (negative zero)
Added Signbit(), revised Copysign() R=rsc CC=golang-dev http://codereview.appspot.com/822045 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/math/signbit.go')
-rw-r--r--src/pkg/math/signbit.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pkg/math/signbit.go b/src/pkg/math/signbit.go
new file mode 100644
index 000000000..670cc1a66
--- /dev/null
+++ b/src/pkg/math/signbit.go
@@ -0,0 +1,10 @@
+// Copyright 2010 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 math
+
+// Signbit returns true if x is negative or negative zero.
+func Signbit(x float64) bool {
+ return Float64bits(x)&(1<<63) != 0
+}