Compare commits

...

2 commits

Author SHA1 Message Date
Philip Dubé
20bfa00fcd comment on significance of 53 bit significand 2024-04-04 13:38:23 +00:00
Philip Dubé
445700e706 %d 2024-04-04 13:33:36 +00:00
2 changed files with 2 additions and 1 deletions

View file

@ -1231,6 +1231,7 @@ func (d Decimal) NumDigits() int {
if d.value.IsInt64() {
i64 := d.value.Int64()
// restrict fast path to integers with exact conversion to float64
if i64 <= (1<<53) && i64 >= -(1<<53) {
if i64 == 0 {
return 1

View file

@ -125,7 +125,7 @@ func numDigits(b *testing.B, want int, val Decimal) {
b.Helper()
for i := 0; i < b.N; i++ {
if have := val.NumDigits(); have != want {
b.Fatalf("\nHave: %q\nWant: %q", have, want)
b.Fatalf("\nHave: %d\nWant: %d", have, want)
}
}
}