rate: Avoid precision loss with edge cases#19
rate: Avoid precision loss with edge cases#19linxiulei wants to merge 1 commit intogolang:masterfrom
Conversation
When burst is 1, there would be edge cases we get tokens of 0.9999999999997222 due to float64 multiplication/division rounding out value. So avoid those calculation when 'last' is old enough Fixes golang/go#46579
|
This PR (HEAD: 81b70a9) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/time/+/325289 to see it. Tip: You can toggle comments from me using the |
|
Message from Go Bot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be Please don’t reply on this GitHub thread. Visit golang.org/cl/325289. |
When burst is 1, there would be edge cases we get tokens of 0.9999999999997222
due to float64 multiplication/division rounding out value. So avoid those
calculation when 'last' is old enough
Fixes golang/go#46579