jquery / jquery/jquery-ui

function _calculateNewMax

Open
#2,184 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Behavior shared with 1.12 Bug Comp: Slider Needs info
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the jQuery UI source for _calculateNewMax and reproduce the price-filter case with max 3469.98, min 2833.05, and step 0.01. Trace the comparison that produces 3469.9800000000005, then verify that the corrected calculation keeps the maximum value available and add regression coverage if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.