-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
More or less by accident, I saw the following warning in one of the finufft CI logs today:
Warning: /home/runner/work/finufft/finufft/test/testutils.cpp:86:7: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
This is bad. It means that abs is called on a floating point argument without having included <math.h> (<cmath> doesn't count - it only provides std::abs). As a consequence, the argument to abs will be truncated to integer, which is definitely not wanted.
Suggested workaround: always use std::abs and make sure that <cmath> is included.
(I'm not sure why "IWYU" is not catching this; but abs is a special case since it can show up in different system headers with different semantics ...)
Metadata
Metadata
Assignees
Labels
No labels