Skip to content

Commit

Permalink
Take care of dff between 0 and 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jcvernaleo committed Feb 17, 2017
1 parent 37eff7b commit 35b76b3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ func DiffToTarget(diff float64, powLimit *big.Int) (*big.Int, error) {
}

// Round down in the case of a non-integer diff since we only support
// ints.
diff = math.Floor(diff)

// ints (unless diff < 1 since we don't allow 0)..
if diff < 1 {
diff = 1
} else {
diff = math.Floor(diff)
}
divisor := new(big.Int).SetInt64(int64(diff))
max := powLimit
target := new(big.Int)
Expand Down

0 comments on commit 35b76b3

Please sign in to comment.