Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
I am adding javascript 0.1 but it is adding missing

I am aiming to find all combinations of a 4 digit number among the given values. But even though I set .1 increment in json it is increasing .09999999. This increment error occurs after step 2. No way could I solve it. Can anyone see where I am wrong in the code below? Have something to add?

window.onload = ()=>{

    class playSearch {




        createCombination(arr) {
    /*
    ppp => i
    atr-f => f
    atr-p => p
    
    */
            this.combination = [];
    
            for (let i = arr[0].min; i <= arr[0].max; i = i + arr[0].plus) {
            
                for (let f = arr[1].min; f <= arr[1].max; f = (f + arr[1].plus)) {
                  console.log(arr[1].plus)
                  console.log(f)
                    for (let p = arr[2].min; p <= arr[2].max; p=p+arr[2].plus) {
                      
                        for (let m = arr[3].min; m <= arr[3].max; m=m+arr[3].plus) {
                         
                            this.combination.push([i,f,p,m])
                           
                        }
                        
                    }
    
                }
                
            }
    
         
    
    
    
    
    
    
        }
    
    }
    
    
    var user = new playSearch();
    user.createCombination(
        [
            {
                "name": "ppp",
                "min": 1,
                "max": 11,
                "plus": 1
            },
    
            {
                "name": "atr-f",
                "min":10,
                "max":20,
                "plus":1/10
            },
            {
                "name":"atr-p",
                "min":1,
                "max":5,
                "plus":1
            },
            {
                "name":"min-profit",
                "min":1,
                "max":5,
                "plus":1
            }
        ]
    )
}

I couldn't understand why .0999 was added even though I added .1. The plus in the json determines the amount of increase. I'm waiting for your help. enter image description here

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!