You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
First, thanks for creating this great library!
Today,
GetDistance
accepts adecimalPlaces
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 callingGetDistance
, 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 useAwayFromZero
).My suggestion would be to take a breaking change and simply remove the rounding behavior from
GetDistance
. Consumers can easily callMath.Round
themselves on the result if they so desire.The text was updated successfully, but these errors were encountered: