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

69
Views
parseInt returning wrong values for values lower than 10^-7

parseInt(0.000001) returns 0

But

parseInt(0.0000001) returns 1


Does anyone happen to know the reason for this behaviour?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If the number is greater than 1e+21 (including) or less than 1e-7 (including), it will return 1. (when using radix/base 10).

e.g.

console.log(parseInt(0.0000001));
console.log(parseInt(0.000000123));
console.log(parseInt(1e-7));
console.log(parseInt(1e+21));

checkout mdn documantation:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#examples

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!