mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-07 01:06:48 +08:00
Merge pull request #163 from biojppm/suppress_float_equal_warning
Suppress compile warning from float comparison
This commit is contained in:
commit
98d46aee9c
@ -99,7 +99,25 @@ fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
|||||||
//
|
//
|
||||||
// Note: This may fail to be accurate if fast-math has been
|
// Note: This may fail to be accurate if fast-math has been
|
||||||
// enabled, as rounding conventions may not apply.
|
// enabled, as rounding conventions may not apply.
|
||||||
|
#if FASTFLOAT_VISUAL_STUDIO
|
||||||
|
# pragma warning(push)
|
||||||
|
// todo: is there a VS warning?
|
||||||
|
// see https://stackoverflow.com/questions/46079446/is-there-a-warning-for-floating-point-equality-checking-in-visual-studio-2013
|
||||||
|
#elif defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wfloat-equal"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
# pragma GCC diagnostic push
|
||||||
|
# pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
return (fmini + 1.0f == 1.0f - fmini);
|
return (fmini + 1.0f == 1.0f - fmini);
|
||||||
|
#if FASTFLOAT_VISUAL_STUDIO
|
||||||
|
# pragma warning(pop)
|
||||||
|
#elif defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
# pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user