q-numeric with 0.1 step lacks rounding
See original GitHub issueHi,
<q-numeric :min="9" :max="199" :step="0.1" v-model="foo"></q-numeric>
foo === 22.1
Click the + button
What is expected ?
foo === 22.2
What is actually happening ?
foo === 22.200000000000003
Cheers
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How do I use a decimal step value for range()? - Stack Overflow
Here's a simple case where rounding error causes arange to produce a length-4 array when it should only produce 3 numbers: >>> numpy.arange(1,...
Read more >Rounding Calculator
Free tool to round numbers to thousands, hundreds, tens, tenths, hundredths, fractions, or many other levels of precision using the popular rounding ......
Read more >Floating-point arithmetic may give inaccurate result in Excel
This can be infinitely repeated. This number cannot be represented in a finite (limited) amount of space. Therefore, this number is rounded down ......
Read more >Numbers - The Modern JavaScript Tutorial
The numeric format IEEE-754 solves this by rounding to the nearest possible number.
Read more >4.8 — Floating point numbers - Learn C++
Rounding errors occur when a number can't be stored precisely. This can happen even with simple numbers, like 0.1. Therefore, rounding errors ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Will fix it. Thanks for reporting!
You can’t even imagine how many things I am handling. Eventually I’ll make a fix myself for this if no one takes it, but it would speed up things if easier tickets are taken from my queue.
For this ticket there’s the Javascript floating point issue occuring (Google it). The fix would be something like
parseFloat(number).toPrecision(X)
when updating the model (where X is the precision of the step).