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

Remove default rounding behavior in GetDistance #27

Open
madelson opened this issue Aug 19, 2023 · 0 comments
Open

Remove default rounding behavior in GetDistance #27

madelson opened this issue Aug 19, 2023 · 0 comments

Comments

@madelson
Copy link

First, thanks for creating this great library!

Today, GetDistance accepts a decimalPlaces parameter which defaults to 1. I find this unintuitive from an API perspective; if I want to do rounding on the value I can easily do it myself after calling GetDistance, I would not expect that method to do it for me. I definitely would not expect it to round to 1 decimal place; that feels arbitrary to me especially when we support different distance units and so 1 decimal place implies many different levels of precision.

Another oddity with this is that the library uses .NET's default "banker's rounding" under the hood (MidpointRoundingMode.ToEven), which doesn't feel like an appropriate choice for coordinate math (I would use AwayFromZero).

My suggestion would be to take a breaking change and simply remove the rounding behavior from GetDistance. Consumers can easily call Math.Round themselves on the result if they so desire.

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

1 participant