horse: fix formatting TenThousandths in (-1, 0)
This commit is contained in:
@@ -12,11 +12,12 @@ type TenThousandths int32
|
||||
|
||||
func (x TenThousandths) String() string {
|
||||
b := make([]byte, 0, 12)
|
||||
if x < 0 {
|
||||
x = -x
|
||||
b = append(b, '-')
|
||||
}
|
||||
b = strconv.AppendInt(b, int64(x/1e4), 10)
|
||||
if x%1e4 != 0 {
|
||||
if x < 0 {
|
||||
x = -x
|
||||
}
|
||||
b = append(b, '.')
|
||||
b = fmt.Appendf(b, "%04d", x%1e4)
|
||||
b = bytes.TrimRight(b, "0")
|
||||
|
||||
Reference in New Issue
Block a user