Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:33

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___CXX03___MATH_REMAINDER_H
0010 #define _LIBCPP___CXX03___MATH_REMAINDER_H
0011 
0012 #include <__cxx03/__config>
0013 #include <__cxx03/__type_traits/enable_if.h>
0014 #include <__cxx03/__type_traits/is_arithmetic.h>
0015 #include <__cxx03/__type_traits/is_same.h>
0016 #include <__cxx03/__type_traits/promote.h>
0017 #include <__cxx03/limits>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 namespace __math {
0026 
0027 // remainder
0028 
0029 inline _LIBCPP_HIDE_FROM_ABI float remainder(float __x, float __y) _NOEXCEPT { return __builtin_remainderf(__x, __y); }
0030 
0031 template <class = int>
0032 _LIBCPP_HIDE_FROM_ABI double remainder(double __x, double __y) _NOEXCEPT {
0033   return __builtin_remainder(__x, __y);
0034 }
0035 
0036 inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double __y) _NOEXCEPT {
0037   return __builtin_remainderl(__x, __y);
0038 }
0039 
0040 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
0041 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remainder(_A1 __x, _A2 __y) _NOEXCEPT {
0042   using __result_type = typename __promote<_A1, _A2>::type;
0043   static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
0044   return __math::remainder((__result_type)__x, (__result_type)__y);
0045 }
0046 
0047 // remquo
0048 
0049 inline _LIBCPP_HIDE_FROM_ABI float remquo(float __x, float __y, int* __z) _NOEXCEPT {
0050   return __builtin_remquof(__x, __y, __z);
0051 }
0052 
0053 template <class = int>
0054 _LIBCPP_HIDE_FROM_ABI double remquo(double __x, double __y, int* __z) _NOEXCEPT {
0055   return __builtin_remquo(__x, __y, __z);
0056 }
0057 
0058 inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {
0059   return __builtin_remquol(__x, __y, __z);
0060 }
0061 
0062 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
0063 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT {
0064   using __result_type = typename __promote<_A1, _A2>::type;
0065   static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
0066   return __math::remquo((__result_type)__x, (__result_type)__y, __z);
0067 }
0068 
0069 } // namespace __math
0070 
0071 _LIBCPP_END_NAMESPACE_STD
0072 
0073 #endif // _LIBCPP___CXX03___MATH_REMAINDER_H