cglm
cglm copied to clipboard
Clang warnings for implicit conversions from float to double
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.
Hi @CaspianA1
Thanks for reporting this, I'll take a look at asap to fix it
@CaspianA1 this is feed at https://github.com/recp/cglm/pull/273 many thanks