Skip to content

Fixes for double #1302

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

Open
wants to merge 2 commits into
base: v3_develop
Choose a base branch
from
Open

Fixes for double #1302

wants to merge 2 commits into from

Conversation

phodina
Copy link

@phodina phodina commented Apr 21, 2025

Minor tweaks around floating point numbers that gave warnings during compilation.

@phodina phodina requested a review from Serafadam April 23, 2025 08:06
@phodina phodina mentioned this pull request Apr 30, 2025
13 tasks
@@ -26,7 +26,8 @@ struct Color {
Color(float r, float g, float b, float a) {
// r,g,b,a values should be in range [0.0, 1.0]
auto check = [](float val) -> float {
if(val < 0.0 || val > 1.0) {
const float epsilon = 1e-6f;
if(val < (0.0f - epsilon) || val > (1.0f + epsilon)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparisons to 0 and 1 should be fine since they can be represented exactly as an IEEE float, no?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm aware, C++ doesn't specify a binary float representation format.

Copy link

@Pandapip1 Pandapip1 May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, IIUC. C++ uses C types, and C specifies IEEE 754 for floating point integers. This is actually not true, it's just that all the compilers use it.

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.

3 participants