boostorg / interval

Boost.org numeric interval library
http://boost.org/libs/numeric/interval/doc
Boost Software License 1.0
24 stars 44 forks source link

Boost.Numeric.Interval: Please specify rounding control mechanism #24

Closed BastienC09 closed 3 years ago

BastienC09 commented 4 years ago

Hi, I am building an app for IOS (ARM) and I had this issue while compiling: Boost.Numeric.Interval: Please specify rounding control mechanism.

C99 version should be used in my case but __USE_ISOC99 is not defined.

Modifying the condition with this code (using __cplusplus) fixed the issue: _boost/numeric/interval/hwrounding.hpp(36)

#if defined(BOOST_NUMERIC_INTERVAL_NO_HARDWARE) && (defined(__USE_ISOC99) || defined(__MSL__) || (defined __cplusplus && __cplusplus >= 201103L))
 #include <boost/numeric/interval/detail/c99_rounding_control.hpp>
#endif

Let me know if I missed something or if you plan to integrate this modification in a next version.

Cheers, Bastien Commelongue

afabri commented 3 years ago

@silene is anybody working on a fix and is what @BastienC09 proposes correct? I @ you, as you are listed as one of the maintainers.

silene commented 3 years ago

Sorry, I was not aware of this issue. Thanks for pinging me. Yes, the proposed fix is correct, since C++11 provides C99's fenv.h.

I guess that, nowadays, the whole conditional would be changed to something like

#if defined(BOOST_NUMERIC_INTERVAL_NO_HARDWARE) && !defined(BOOST_NO_FENV_H)
#include <boost/numeric/interval/detail/c99_rounding_control.hpp>
#endif
afabri commented 3 years ago

So will you create a pull request?