Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
Change large values from string to number type JS

I have a big problem with large values that I have to change from string to number with two decimal places.

Examples:

parseFloat('99999999999999.99') 

What I get: 99999999999999.98

What I want to get: 99999999999999.99

parseFloat('99999999999999000000.00').toFixed(2)

What I get: '99999999999999000576.00'

What I want to get: '99999999999999000000.00'

parseFloat('999999999999999999999.99')

What I get: 1e+21

What I want to get: 999999999999999999999.99

Also, I have a problem with rounding:

(9.555).toFixed(2)

What I get: '9.55'

What I want to get: '9.56'

Is there any library that can help me with this problem? I really want the resulting value to be of type number.

I know is BigInt type, but I have decimals. I know is bignumber library, but the resulting values are strings.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda