Skip to content

Commit

Permalink
math/big: remove NaN support - just not worth it
Browse files Browse the repository at this point in the history
NaNs make the API more complicated for no real good reasons.
There are few operations that produce NaNs with IEEE arithmetic,
there's no need to copy the behavior. It's easy to test for these
scenarios and avoid them (on the other hand, it's not easy to test
for overflow or underflow, so we want to keep +/-Inf).

Also:
- renamed IsNeg -> Signbit (clearer, especially for x == -0)
- removed IsZero           (Sign() == 0 is sufficient and efficient)
- removed IsFinite         (now same as !IsInf)

Change-Id: I3f3b4445c325d9bbb1bf46ce2e298a6aeb498e07
Reviewed-on: https://go-review.googlesource.com/8280
Reviewed-by: Alan Donovan <[email protected]>
  • Loading branch information
griesemer committed Mar 31, 2015
1 parent 67426a8 commit fa85a72
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 337 deletions.
7 changes: 4 additions & 3 deletions src/math/big/accuracy_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ package big

import "fmt"

const _Accuracy_name = "ExactBelowAboveUndef"
const _Accuracy_name = "BelowExactAbove"

var _Accuracy_index = [...]uint8{0, 5, 10, 15, 20}
var _Accuracy_index = [...]uint8{0, 5, 10, 15}

func (i Accuracy) String() string {
i -= -1
if i < 0 || i+1 >= Accuracy(len(_Accuracy_index)) {
return fmt.Sprintf("Accuracy(%d)", i)
return fmt.Sprintf("Accuracy(%d)", i+-1)
}
return _Accuracy_name[_Accuracy_index[i]:_Accuracy_index[i+1]]
}
Loading

0 comments on commit fa85a72

Please sign in to comment.