Skip to content
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

Stop using INT_MIN/INT_MAX for floats #2094

Merged
merged 1 commit into from Aug 17, 2023
Merged

Conversation

pinotree
Copy link
Contributor

INT_MIN/INT_MAX are meant for the int type, and thus casting them to a different type (float) means loss of precision which may lead to failed comparisons later on.

Instead use the proper limits using std::numeric_limits.

INT_MIN/INT_MAX are meant for the int type, and thus casting them to a
different type (float) means loss of precision which may lead to failed
comparisons later on.

Instead use the proper limits using std::numeric_limits.
@sarunasb sarunasb merged commit e1fc29f into lensfun:master Aug 17, 2023
3 checks passed
@pinotree pinotree deleted the fix-floats branch August 18, 2023 03:18
pinotree added a commit to pinotree/lensfun that referenced this pull request Aug 18, 2023
INT_MIN/INT_MAX are meant for the int type, and thus casting them to a
different type (float) means loss of precision which may lead to failed
comparisons later on.

Instead use the proper limits using std::numeric_limits.

(cherry picked from commit e1fc29f)
@pinotree
Copy link
Contributor Author

Thanks @sarunasb! Since the problem affects also lensfun 0.3, I backported this to the release_0.3.x branch: #2098.

sarunasb pushed a commit that referenced this pull request Aug 23, 2023
INT_MIN/INT_MAX are meant for the int type, and thus casting them to a
different type (float) means loss of precision which may lead to failed
comparisons later on.

Instead use the proper limits using std::numeric_limits.

(cherry picked from commit e1fc29f)
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.

None yet

2 participants