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
Avoid FP arithmetic if unnecessary in CGRect.intersection(_:) #1977
Conversation
Could you add a unit test to this covering the example from the jira? |
@spevans Updated! |
width = overlapH.upperBound - overlapH.lowerBound | ||
} | ||
|
||
let height: CGFloat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better as a multi-ternary?
let height = overlapV == rect1SpanV ? rect1.height :
overlapV == rect2SpanV ? rect2.height :
overlapV.upperBound - overlapV.lowerBound
@swift-ci test |
@spevans Does the error here appear to be related to these changes? It's fairly opaque to me. |
@swift-ci please test |
@compnerd Any idea what this failure is? I've just rebased against |
Unfortunately, that erases the logs, so you cannot really tell what went wrong. |
@swift-ci please test |
See SR-10056 for a summary of this issue with example. The floating point arithmetic in
CGRect.intersection(_:)
results in a rectangle not equal to its intersection withCGRect.infinity
.