Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda