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

141
Views
lodash _.sum method is giving odd result

I am using lodash version 4.17.15 Here when I am using its _.sum method, with certain values, I'm getting a bit odd result Here are some examples

_.sum([5.32,1.25,1.3])

this is giving correct result #7.87

but when I'm doing this

_.sum([6.32,1.25,1.3])

the result is #8.870000000000001

I unable to find any reason or any supporting document on how this sum method actually works and why its giving such a drastically different result where apparently I just gave it 3 numbers to do a simple summation.

I was doing a live test here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is due to javascript's precision. If you add those 3 numbers together in the console you will get the same result, so it is not an issue with lodash.

You can check this question for more info on the subject

about 4 years ago · Juan Pablo Isaza Report
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!