Skip to content
New issue

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

Can't convert nautical miles to meters correctly #145

Open
r-hede opened this issue Feb 19, 2024 · 1 comment
Open

Can't convert nautical miles to meters correctly #145

r-hede opened this issue Feb 19, 2024 · 1 comment

Comments

@r-hede
Copy link

r-hede commented Feb 19, 2024

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

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

The problem only occurs with certain values.

Is this problem already known?

@glepretre
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants