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

199
Views
Math.sin () se comporta de manera extraña en javascript

Por alguna razón, cuando ingreso Math.PI y 3.14, obtengo resultados completamente diferentes e incluso imposibles.

Editar: No importa, soy tonto y no noté el e-16

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

0

Da ~10^-16 algo muy cercano a cero que puedes

 console.log(Math.sin(Math.PI).toFixed(2))

about 4 years ago · Juan Pablo Isaza Report

0

Aquí he configurado una prueba de su problema

 console.log(Math.sin(3.14)); console.log(Math.sin(Math.PI));

Cuando ejecuto, obtengo este resultado:

 0.0015926529164868282 1.2246467991473532e-16

El segundo número es un número positivo muy, muy pequeño. Es esencialmente 0. El primer número es un poco más grande, pero 3.14 es un valor redondeado de PI, y es por eso que obtienes la diferencia.

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!