Fix False Null MOI warnings#4535
Merged
Goober5000 merged 3 commits intoAug 15, 2022
Merged
Conversation
In #4443, `fl_near_zero` was set to use default epsilon values in the `IS_VEC_NULL` check. In this comparison, epsilon is the wrong threshold because it used to have a much smaller threshold. The fix restores the previous definitions of `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` by exposing the epsilon value as an optional parameter (similar to how `IS_NEAR_ZERO` used to work. This PR also restores `IS_VEC_NULL_SQ_SAFE` where it was replaced by `IS_VEC_NULL.`
JohnAFernandez
requested changes
Aug 13, 2022
JohnAFernandez
approved these changes
Aug 13, 2022
Goober5000
requested changes
Aug 13, 2022
Goober5000
approved these changes
Aug 14, 2022
Goober5000
requested changes
Aug 14, 2022
Goober5000
left a comment
Contributor
There was a problem hiding this comment.
Actually hang on while I research some floating point things
Goober5000
approved these changes
Aug 15, 2022
Contributor
|
Approving this for the time being. Other floating-point changes can go in a follow-up PR. |
Goober5000
added a commit
to Goober5000/fs2open.github.com
that referenced
this pull request
Aug 19, 2022
Floating-point comparisons are tricky beasts. See this article for a good summary of the issues involved: https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ This PR improves support somewhat, although there are obviously situations in the code (such as comparisons to 0) that should still be addressed. This PR makes the following improvements: 1) Tightens the threshold on `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` from 1e-16 and 1e-36 to FLT_EPSILON 2) Tightens the threshold for parsing `turn_time` in POFs 3) Restores the previous implementation of `fl_equal` 4) Adds a dedicated `IS_MOI_VEC_NULL` for moment of inertia values 5) Improves documentation Follow-up to scp-fs2open#4535 and scp-fs2open#4443.
Goober5000
added a commit
to Goober5000/fs2open.github.com
that referenced
this pull request
Aug 26, 2022
Floating-point comparisons are tricky beasts. See this article for a good summary of the issues involved: https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ This PR improves support somewhat, although there are obviously situations in the code (such as comparisons to 0) that should still be addressed. This PR makes the following improvements: 1) Tightens the threshold on `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` from 1e-16 and 1e-36 to FLT_EPSILON 2) Tightens the threshold for parsing `turn_time` in POFs 3) Restores the previous implementation of `fl_equal` 4) Adds a dedicated `IS_MOI_VEC_NULL` for moment of inertia values 5) Improves documentation Follow-up to scp-fs2open#4535 and scp-fs2open#4443.
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.
In #4443,
fl_near_zerowas set to use default epsilon values in theIS_VEC_NULLcheck. In this comparison, epsilon is the wrong threshold because it used to have a much smaller threshold. The fix restores the previous definitions ofIS_VEC_NULLandIS_VEC_NULL_SQ_SAFEby exposing the epsilon value as an optional parameter (similar to howIS_NEAR_ZEROused to work. This PR also restoresIS_VEC_NULL_SQ_SAFEwhere it was replaced byIS_VEC_NULL.Fixes #4534.