grid2: use Round instead of Trunc

This commit is contained in:
c9s 2023-02-01 15:48:19 +08:00
parent d43acaa17c
commit 4bf0cb6a0c
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -39,7 +39,7 @@ func calculateArithmeticPins(lower, upper, spread, tickSize fixedpoint.Value) []
for p := lower; p.Compare(upper) <= 0; p = p.Add(spread) { for p := lower; p.Compare(upper) <= 0; p = p.Add(spread) {
// tickSize here = 0.01 // tickSize here = 0.01
pp := p.Float64() / ts pp := p.Float64() / ts
pp = math.Trunc(pp) * ts pp = math.Round(pp) * ts
pin := Pin(fixedpoint.NewFromFloat(pp)) pin := Pin(fixedpoint.NewFromFloat(pp))
pins = append(pins, pin) pins = append(pins, pin)
} }