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

Clang warnings for implicit conversions from float to double #228

Closed
CaspianA1 opened this issue Nov 8, 2021 · 2 comments
Closed

Clang warnings for implicit conversions from float to double #228

CaspianA1 opened this issue Nov 8, 2021 · 2 comments

Comments

@CaspianA1
Copy link

CaspianA1 commented Nov 8, 2021

When using the clang flag -Wdouble-promotion and including <cglm/cglm.h>, a maelstrom of implicit float-to-double conversion errors arise. Here is a small snippet of the 23 warnings I got:

/usr/local/include/cglm/vec2-ext.h:65:13: warning: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion]
         && fabsf(v[1] - val) <= GLM_FLT_EPSILON;
            ^~~~~~~~~~~~~~~~~ ~~
/usr/local/include/cglm/vec2-ext.h:64:10: warning: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion]
  return fabsf(v[0] - val) <= GLM_FLT_EPSILON
         ^~~~~~~~~~~~~~~~~ ~~
/usr/local/include/cglm/vec2-ext.h:101:13: warning: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion]
         && fabsf(a[1] - b[1]) <= GLM_FLT_EPSILON;
            ^~~~~~~~~~~~~~~~~~ ~~
/usr/local/include/cglm/vec2-ext.h:100:10: warning: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion]
  return fabsf(a[0] - b[0]) <= GLM_FLT_EPSILON
         ^~~~~~~~~~~~~~~~~~ ~~

I do not have the time, but if someone does, please declare the preprocessor constant GLM_FLT_EPSILON as a float. This not being the case is the sole cause of the warnings.

@recp
Copy link
Owner

recp commented Nov 8, 2021

Hi @CaspianA1

Thanks for reporting this, I'll take a look at asap to fix it

@recp
Copy link
Owner

recp commented Dec 31, 2022

@CaspianA1 this is feed at #273 many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants