cannawen / metric_units_reddit_bot

Reddit bot converting imperial units to metric units
https://www.reddit.com/user/metric_units
GNU General Public License v3.0
78 stars 34 forks source link

Improve rounding #89

Closed cannawen closed 6 years ago

cannawen commented 6 years ago

The bot is currently rounding to the same number of decimals as input or 3-5% error, but it should be following standard rounding rules.

when adding or subtracting the answer should have the same amount of decimals as the least precise number. When multiplying or dividing the product should have the same number of significant figures as the least precise factor

jacobScottAllen commented 6 years ago

It seems like the link no longer works.

cannawen commented 6 years ago

@jacobScottAllen Fixed description, sorry about that :)

nalinbhardwaj commented 6 years ago

@cannawen I think this might be overkill in some conversions, especially if the user doesn't really care about precision. A better heuristic might be to follow the standard rounding rules, and in case with these rules, it has more than twice the significant figures, round it off with 3 or 5% error.

cannawen commented 6 years ago

Closing due to inactivity - Perhaps a future enhancement to look into.