/ externals / catch / src / catch2 / internal / catch_polyfills.cpp
catch_polyfills.cpp
 1  
 2  //              Copyright Catch2 Authors
 3  // Distributed under the Boost Software License, Version 1.0.
 4  //   (See accompanying file LICENSE.txt or copy at
 5  //        https://www.boost.org/LICENSE_1_0.txt)
 6  
 7  // SPDX-License-Identifier: BSL-1.0
 8  
 9  #include <catch2/internal/catch_polyfills.hpp>
10  #include <catch2/internal/catch_compiler_capabilities.hpp>
11  #include <catch2/catch_user_config.hpp>
12  
13  #include <cmath>
14  
15  namespace Catch {
16  
17  #if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
18      bool isnan(float f) {
19          return std::isnan(f);
20      }
21      bool isnan(double d) {
22          return std::isnan(d);
23      }
24  #else
25      // For now we only use this for embarcadero
26      bool isnan(float f) {
27          return std::_isnan(f);
28      }
29      bool isnan(double d) {
30          return std::_isnan(d);
31      }
32  #endif
33  
34  #if !defined( CATCH_CONFIG_GLOBAL_NEXTAFTER )
35      float nextafter( float x, float y ) { return std::nextafter( x, y ); }
36      double nextafter( double x, double y ) { return std::nextafter( x, y ); }
37  #else
38      float nextafter( float x, float y ) { return ::nextafterf( x, y ); }
39      double nextafter( double x, double y ) { return ::nextafter( x, y ); }
40  #endif
41  
42  } // end namespace Catch