Metric Imperial Converter - Rounding Issue

Tell us what’s happening:
I’m having an issue with outputting the number and including the 5th digit. It seems during my conversions using parseFloat and toFixed, there is a rounding that is occuring to the 4th decimal place and I cannot get it to output as a number with the 5th digit. I cannot figure out where this rounding is coming from and when it rounds it sets the last digit to 0 and then will not print the final digit.

###Errors:

  • Error: expected 2.6417 to equal 2.64172
  • Error: expected 22.0462 to equal 22.04624
  • Error: expected 0.61214 to equal 0.62137

Your project link(s)

solution: https://replit.com/@13cbenjamin/fccmetric-imperial-converter

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36

Challenge: Metric-Imperial Converter

Link to the challenge:

This issue is resolved. My problem was caused by not Dividing against the conversion rate. All of my conversions were multiplications and it retrieved slightly different answers than using a division equation in terms of rounding to get it to pass the tests.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.