ghorn / dynobud

your dynamic optimization buddy
GNU Lesser General Public License v3.0
27 stars 5 forks source link

implicit cast from float to int when using abs #100

Closed guibou closed 5 years ago

guibou commented 5 years ago

clang build returns warning here: https://github.com/ghorn/dynobud/blob/0d8a9494e66b25aa371cf05add923a44688eb173/dynobud-interpolant/cbits/interpolant.cpp#L59

external/dynobud/dynobud-interpolant/cbits/interpolant.cpp:59:9: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
    if (abs(ref-v[i])>margin) return false;
        ^
external/dynobud/dynobud-interpolant/cbits/interpolant.cpp:59:9: note: use function 'std::abs' instead
    if (abs(ref-v[i])>margin) return false;
        ^~~
        std::abs

I'll be happy to submit a PR, but I don't really understand the semantic and I suspect an incorrect usage of abs instead of std::abs or absf.

jaeandersson commented 5 years ago

I think it's supposed to be fabs

ghorn commented 5 years ago

fixed https://github.com/ghorn/dynobud/commit/78e6f560c40b032fb6b8530c21d089bbc557c23d