Skip to content

Commit 6ea33b3

Browse files
Merge pull request #17 from goinsane/develop
v1.7.1
2 parents 52ea5b7 + 0afa88a commit 6ea33b3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

xmath.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,7 @@ func Zero(sign int) float64 {
601601
// +1 if x > 0
602602
// Sign panics if x is NaN.
603603
func Sign(x float64) int {
604-
if math.IsNaN(x) {
605-
panicForNaN(x)
606-
}
604+
panicForNaN(x)
607605
switch {
608606
case x < 0:
609607
return -1
@@ -614,9 +612,9 @@ func Sign(x float64) int {
614612
}
615613

616614
// SignInt returns:
617-
// -1 if x < 0
618-
// 0 if x is 0
619-
// +1 if x > 0
615+
// -1 if x < 0
616+
// 0 if x is 0
617+
// +1 if x > 0
620618
func SignInt(x int64) int {
621619
switch {
622620
case x < 0:
@@ -730,7 +728,7 @@ func AvgUint2(x ...uint64) (avg uint64, overflow bool) {
730728
}
731729

732730
func panicForInvalidBase(base int) {
733-
if base < MinBase || base > MaxBase {
731+
if !(MinBase <= base && base <= MaxBase) {
734732
panic("invalid base")
735733
}
736734
}

0 commit comments

Comments
 (0)