Skip to content

Commit

Permalink
Fix: Replace hardcoded int literal with variable
Browse files Browse the repository at this point in the history
Use `MaximumPrecision` in for loop.

Signed-off-by: omani <3346207+omani@users.noreply.github.com>
  • Loading branch information
omani authored and yilunzhang committed Jul 24, 2023
1 parent 2ae996a commit f9a9a48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/Fixed64.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
StorageFactor = 100000000
)

//the 64 bit fixed-point number, precise 10^-8
// the 64 bit fixed-point number, precise 10^-8
type Fixed64 int64

func (f *Fixed64) Serialize(w io.Writer) error {
Expand Down Expand Up @@ -59,7 +59,7 @@ func (f Fixed64) String() string {
if value > 0 {
buffer.WriteRune('.')
s := strconv.FormatUint(value, 10)
for i := len(s); i < 8; i++ {
for i := len(s); i < MaximumPrecision; i++ {
buffer.WriteRune('0')
}
buffer.WriteString(s)
Expand Down

0 comments on commit f9a9a48

Please sign in to comment.