Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function _calculateNewMax #2184

Open
rsn073 opened this issue Sep 4, 2023 · 5 comments
Open

function _calculateNewMax #2184

rsn073 opened this issue Sep 4, 2023 · 5 comments

Comments

@rsn073
Copy link

rsn073 commented Sep 4, 2023

I found a bug in the calculation of the formula in the _calculateNewMax function, but there is also a little bug with js like 0.1+0.2=0.30000000000000004

If we use the library for the price filter, namely the slider from it, and for example if prices come
max - 3469.98
min - 2833.05
step - 0.01

then the formula yields the number 3469.9800000000005

then there is a comparison and 3469.9800000000005 will be greater than 3469.98, we enter the condition and subtract from 3469.9800000000005 - 0.01 and we have 3469.97 at the output, so for example, in the filter we will never see a product with a maximum price

@fnagel
Copy link
Member

fnagel commented Sep 4, 2023

Thanks for the report. Does the issue you describe exist when jQuery UI 1.12.1 is used or only with jQuery UI 1.13.0 or newer?

@rsn073
Copy link
Author

rsn073 commented Sep 5, 2023

I found it on jQuery UI 1.12.1

@mgol
Copy link
Member

mgol commented Sep 12, 2023

Thanks for the report. Since the issue is already in 1.12, given limited team resources it's not likely to be fixed by the UI team; see the project status at https://blog.jqueryui.com/2021/10/jquery-maintainers-update-and-transition-jquery-ui-as-part-of-overall-modernization-efforts/. PRs are welcome if they're not too complex.

@mgol
Copy link
Member

mgol commented Sep 12, 2023

(also, please add a test case)

@cccczzzyyyy
Copy link

version 1.13.2 also has this issue
below is the example, you can see the console values are not correspond with max1 , which is calculate by function _calculateNewMax
`
let max1=19.7,
min1=14.3
$( "#slider" ).slider({
min: min1,
max: max1,
range: true,
step: 0.1,
values: [ min1, max1 ],
create: function( event, ui ) {
console.log($(this).slider('values'))
}
});

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants