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

188
Views
Converting a float to Hexadecimal and again to float changes the value slightly in javascript

I am working on a finance application where a small decimal point matters a lot. While I was working at it, I discovered that js changes the actual value when transforming to to hex and decimal to and fro.

For example:

a = (parseFloat(49098.40463663199) * 10 **18).toString(16)

gives me

a65a13dc28529800000

Adding 0x at the beginning and dividing by the number it was multiplied to changes the number slightly like:

0xa65a13dc28529800000 / 10 ** 18

gives me

49098.40463663198

Notice that the value decreased by 0.00000000001?

I want to avoid this. How can I?

Here is the picture for the same calculation on console: Console picture

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!