I just came across the Pow implementation in golang:
func Pow(x, y float64) float64 {
// ...
case x == 0:
switch {
case y < 0:
if isOddInt(y) {
return Copysign(Inf(1), x)
}
return Inf(1)
case y > 0:
if isOddInt(y) {
return x
}
return 0
}
//...
}
Isn't the case y > 0
part over complicated? I would just return 0. Or did I miss something?