Skip to content

Commit

Permalink
Merge pull request #17 from goinsane/develop
Browse files Browse the repository at this point in the history
v1.7.1
  • Loading branch information
orkunkaraduman authored Nov 15, 2021
2 parents 52ea5b7 + 0afa88a commit 6ea33b3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions xmath.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,7 @@ func Zero(sign int) float64 {
// +1 if x > 0
// Sign panics if x is NaN.
func Sign(x float64) int {
if math.IsNaN(x) {
panicForNaN(x)
}
panicForNaN(x)
switch {
case x < 0:
return -1
Expand All @@ -614,9 +612,9 @@ func Sign(x float64) int {
}

// SignInt returns:
// -1 if x < 0
// 0 if x is 0
// +1 if x > 0
// -1 if x < 0
// 0 if x is 0
// +1 if x > 0
func SignInt(x int64) int {
switch {
case x < 0:
Expand Down Expand Up @@ -730,7 +728,7 @@ func AvgUint2(x ...uint64) (avg uint64, overflow bool) {
}

func panicForInvalidBase(base int) {
if base < MinBase || base > MaxBase {
if !(MinBase <= base && base <= MaxBase) {
panic("invalid base")
}
}
Expand Down

0 comments on commit 6ea33b3

Please sign in to comment.