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

382
Visualizações
How to multiply decimals out of variable of type Number in TypeScript?

Lets say I have an number which is equal to 288.65 and I want to multiply out the decimal point to achieve the desired result of 28865

If I simply just try say console.log(288.65 * 100) it will return 28864.999999999996 I am not sure why it is doing this, any help will be much appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use Math.ceil and with Math.round

The Math.ceil() function always rounds a number up to the next largest integer.

The Math.round() function returns the value of a number rounded to the nearest integer.

const num = 288.65;

const result1 = Math.round(num * 100);
const result2 = Math.ceil(num * 100);

console.log(result1);
console.log(result2);

about 4 years ago · Juan Pablo Isaza Relatório
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