We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to set up a converter between the units m and Nm (meters -> nautical miles) like this:
console.log(Qty("55560 m").to("naut-mile").scalar); // 30.000000000000007
console.log(Qty("55560 m").to("naut-mile").scalar);
A nautical mile is equal to 1852 meters, so the following calculation must be performed during this conversion:
55560 / 1852 = 30
So there shouldn't be so many zeros after the decimal point.
However, this is not the case with the following conversion, for example:
console.log(Qty("53708 m").to("naut-mile").scalar); // 29
console.log(Qty("53708 m").to("naut-mile").scalar);
The problem only occurs with certain values.
Is this problem already known?
The text was updated successfully, but these errors were encountered:
This is a JavaScript issue : https://stackoverflow.com/questions/47634766/algorithm-to-correct-the-floating-point-precision-error-in-javascript
You can use toPrec method or custom formatting to prevent it 😉
Sorry, something went wrong.
No branches or pull requests
I'm trying to set up a converter between the units m and Nm (meters -> nautical miles) like this:
console.log(Qty("55560 m").to("naut-mile").scalar);
// 30.000000000000007A nautical mile is equal to 1852 meters, so the following calculation must be performed during this conversion:
55560 / 1852 = 30
So there shouldn't be so many zeros after the decimal point.
However, this is not the case with the following conversion, for example:
console.log(Qty("53708 m").to("naut-mile").scalar);
// 29The problem only occurs with certain values.
Is this problem already known?
The text was updated successfully, but these errors were encountered: