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

173
Views
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
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!