horse: fix formatting TenThousandths in (-1, 0)

This commit is contained in:
2026-01-17 00:04:35 -05:00
parent a86aa0daeb
commit e6032f995f
2 changed files with 6 additions and 3 deletions

View File

@@ -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")