question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

q-numeric with 0.1 step lacks rounding

See original GitHub issue

Hi,

<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:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rstoenescucommented, Dec 16, 2016

Will fix it. Thanks for reporting!

0reactions
rstoenescucommented, Dec 16, 2016

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found