Skip to content

Commit c4cca6f

Browse files
author
jon4hz
committed
remove print, replace magic number with const
1 parent 633edb2 commit c4cca6f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

entities/fraction.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package entities
22

33
import (
4-
"fmt"
54
"math/big"
65
"strings"
76

@@ -14,6 +13,8 @@ import (
1413
// ZeroFraction zero fraction instance
1514
var ZeroFraction = NewFraction(constants.Zero, nil)
1615

16+
const decimalSplitLength = 2
17+
1718
// Fraction warps math franction
1819
type Fraction struct {
1920
Numerator *big.Int
@@ -129,13 +130,12 @@ func (f *Fraction) ToSignificant(significantDigits uint, opt ...number.Option) s
129130
if v, err := number.DecimalRound(d, f.opts); err == nil {
130131
d = v
131132
}
132-
fmt.Println(d.String())
133133
return number.DecimalFormat(d, f.opts)
134134
}
135135

136136
func countZerosAfterDecimalPoint(d string) uint {
137137
grp := strings.Split(d, ".")
138-
if len(grp) != 2 {
138+
if len(grp) != decimalSplitLength {
139139
return 0
140140
}
141141
for i, v := range grp[1] {

0 commit comments

Comments
 (0)