summaryrefslogtreecommitdiff
path: root/libgo/go/math/modf.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/math/modf.go')
-rw-r--r--libgo/go/math/modf.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libgo/go/math/modf.go b/libgo/go/math/modf.go
index ecec4b756c7..5d2f489b709 100644
--- a/libgo/go/math/modf.go
+++ b/libgo/go/math/modf.go
@@ -16,9 +16,12 @@ func Modf(f float64) (int float64, frac float64) {
func modf(f float64) (int float64, frac float64) {
if f < 1 {
- if f < 0 {
+ switch {
+ case f < 0:
int, frac = Modf(-f)
return -int, -frac
+ case f == 0:
+ return f, f // Return -0, -0 when f == -0
}
return 0, f
}