q-numeric with 0.1 step lacks rounding #261

Closed
caex opened this Issue Dec 16, 2016 · 5 comments

Projects

None yet

3 participants

@caex
caex commented Dec 16, 2016

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

@rstoenescu
Collaborator

Will fix it. Thanks for reporting!

@vuchl
Contributor
vuchl commented Dec 16, 2016
@rstoenescu
Collaborator

@vuchl it doesn't have to be passed to the input. Look down the file.

Who cares for an easy PR on this?

@vuchl
Contributor
vuchl commented Dec 16, 2016

@rstoenescu hmm. for me the code looks good. can't spot it. but if you allready identified the cause, why not commit the fix yourself?

@rstoenescu
Collaborator

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

@rstoenescu rstoenescu added a commit that closed this issue Dec 18, 2016
@rstoenescu rstoenescu fix: #261 q-numeric with 0.1 step lacks rounding
Add "max-decimals" prop.
23d1a4d
@rstoenescu rstoenescu added this to the v0.11 milestone Dec 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment