summaryrefslogtreecommitdiff
path: root/libgo/go/math/logb.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/math/logb.go')
-rw-r--r--libgo/go/math/logb.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/libgo/go/math/logb.go b/libgo/go/math/logb.go
index 072281ddf9f..d32f9f1000c 100644
--- a/libgo/go/math/logb.go
+++ b/libgo/go/math/logb.go
@@ -11,15 +11,13 @@ package math
// Logb(0) = -Inf
// Logb(NaN) = NaN
func Logb(x float64) float64 {
- // TODO(rsc): Remove manual inlining of IsNaN, IsInf
- // when compiler does it for us
// special cases
switch {
case x == 0:
return Inf(-1)
- case x < -MaxFloat64 || x > MaxFloat64: // IsInf(x, 0):
+ case IsInf(x, 0):
return Inf(1)
- case x != x: // IsNaN(x):
+ case IsNaN(x):
return x
}
return float64(ilogb(x))
@@ -32,15 +30,13 @@ func Logb(x float64) float64 {
// Ilogb(0) = MinInt32
// Ilogb(NaN) = MaxInt32
func Ilogb(x float64) int {
- // TODO(rsc): Remove manual inlining of IsNaN, IsInf
- // when compiler does it for us
// special cases
switch {
case x == 0:
return MinInt32
- case x != x: // IsNaN(x):
+ case IsNaN(x):
return MaxInt32
- case x < -MaxFloat64 || x > MaxFloat64: // IsInf(x, 0):
+ case IsInf(x, 0):
return MaxInt32
}
return ilogb(x)