fix handling of rounding to 12 inches in FeetInches#1656
Open
Applesauce314 wants to merge 2 commits intoangularsen:masterfrom
Open
fix handling of rounding to 12 inches in FeetInches#1656Applesauce314 wants to merge 2 commits intoangularsen:masterfrom
Applesauce314 wants to merge 2 commits intoangularsen:masterfrom
Conversation
Author
|
it looks like this pipeline failure is unrelated to my change, anything i need to do? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
updates the string outputs of
FeetInchesto propagate the rounding of inches up to feet if the inches are rounded to 12.i.e 3.9999 ft in feet inches is 3 feet 11.9988 inches.
ToStringwill round the 11.9988 to 12 and output 3 ft 12 in, which is incorrect.ToArchitecturalStringwill do the same if the denominator is is not small enough to result is a fractional part that is not rounded to 1.this PR updates these methods to propagate the rounding of these functions up to the feet part while resetting the inches to 0.
i.e.
3 ft 11.9988 inbecomes4 ft 0 ininstead of3 ft 12 in.the current behavior is unexpected for a mixed radix system, and this PR implements the expected default behavior.
(for an example of a similar situation, if rounding 09:59:50 to the nearest minute, you would get 10:00, not 09:60)
this issue had been previously discussed in #158, but does not provide a way to configure the behavior as mentioned there.