Skip to content

fix handling of rounding to 12 inches in FeetInches#1656

Open
Applesauce314 wants to merge 2 commits intoangularsen:masterfrom
Applesauce314:patch-2
Open

fix handling of rounding to 12 inches in FeetInches#1656
Applesauce314 wants to merge 2 commits intoangularsen:masterfrom
Applesauce314:patch-2

Conversation

@Applesauce314
Copy link
Copy Markdown

updates the string outputs of FeetInches to 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.
ToString will round the 11.9988 to 12 and output 3 ft 12 in, which is incorrect.
ToArchitecturalString will 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 in becomes 4 ft 0 in instead of 3 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.

@Applesauce314
Copy link
Copy Markdown
Author

it looks like this pipeline failure is unrelated to my change, anything i need to do?

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

Successfully merging this pull request may close these issues.

1 participant