Vue docs Animating with Watchers example causes precision errors for large numbers (floating point limit)
Problem: In the Vue official documentation (Animation Techniques - Animating with Watchers), when typing a very large number like 9999999999999999, the number animation becomes inaccurate because of JavaScript floating-point limits.
Steps to Reproduce:
- Open the Animation Techniques - Animating with Watchers page.
- Enter a very large number (e.g., 9999999999999999).
- See the displayed number is wrong.
Expected: The animation should either prevent too large numbers or mention this limitation.
Suggestion:
- Limit input range (below Number.MAX_SAFE_INTEGER)
- Add a note explaining floating-point limits.
I'd vote for the option two, because adding extra logic into code will obsfucate the example for an edge case.
Something like: "Note that inputs larger than 9007199254740991 (better known as Number.MAX_SAFE_INTEGER) may produce inconsistent results due to floating-point artithmetics' limitations of JavaScript."
I'd vote for the option two, because adding extra logic into code will obsfucate the example for an edge case.
Something like: "Note that inputs larger than
9007199254740991(better known asNumber.MAX_SAFE_INTEGER) may produce inconsistent results due to floating-point artithmetics' limitations of JavaScript."
Thank you for your input! I agree that keeping the example simple and adding a short note would be more appropriate. I have revise the example accordingly and submit a PR with a clarification comment on Number.MAX_SAFE_INTEGER. Appreciate your feedback!