@@ -56,37 +56,37 @@ struct __hypot_factors {
56
56
57
57
// returns [underflow_factors, overflow_factors]
58
58
template <class _Real >
59
- _LIBCPP_HIDE_FROM_ABI std::array<__hypot_factors<_Real>, 2 > __create_factors () {
59
+ _LIBCPP_HIDE_FROM_ABI std::array<__math:: __hypot_factors<_Real>, 2 > __create_factors () {
60
60
static_assert (std::numeric_limits<_Real>::is_iec559);
61
61
62
- __hypot_factors<_Real> __underflow, __overflow;
62
+ __math:: __hypot_factors<_Real> __underflow, __overflow;
63
63
if constexpr (std::is_same_v<_Real, float >) {
64
64
static_assert (-125 == std::numeric_limits<_Real>::min_exponent);
65
65
static_assert (+128 == std::numeric_limits<_Real>::max_exponent);
66
- __underflow = __hypot_factors<_Real>{0x1 .0p-62f , 0x1 .0p70f, 0x1 .0p-70f };
67
- __overflow = __hypot_factors<_Real>{0x1 .0p62f, 0x1 .0p-70f , 0x1 .0p+70f };
66
+ __underflow = __math:: __hypot_factors<_Real>{0x1 .0p-62f , 0x1 .0p70f, 0x1 .0p-70f };
67
+ __overflow = __math:: __hypot_factors<_Real>{0x1 .0p62f, 0x1 .0p-70f , 0x1 .0p+70f };
68
68
} else if constexpr (std::is_same_v<_Real, double >) {
69
69
static_assert (-1021 == std::numeric_limits<_Real>::min_exponent);
70
70
static_assert (+1024 == std::numeric_limits<_Real>::max_exponent);
71
- __underflow = __hypot_factors<_Real>{0x1 .0p-510 , 0x1 .0p600, 0x1 .0p-600 };
72
- __overflow = __hypot_factors<_Real>{0x1 .0p510, 0x1 .0p-600 , 0x1 .0p+600 };
71
+ __underflow = __math:: __hypot_factors<_Real>{0x1 .0p-510 , 0x1 .0p600, 0x1 .0p-600 };
72
+ __overflow = __math:: __hypot_factors<_Real>{0x1 .0p510, 0x1 .0p-600 , 0x1 .0p+600 };
73
73
} else { // long double
74
74
static_assert (std::is_same_v<_Real, long double >);
75
75
if constexpr (sizeof (_Real) == sizeof (double ))
76
- return static_cast <std::array<__hypot_factors<_Real>, 2 >>(__create_factors<double >());
76
+ return static_cast <std::array<__math:: __hypot_factors<_Real>, 2 >>(__math:: __create_factors<double >());
77
77
else {
78
78
static_assert (-16'381 == std::numeric_limits<_Real>::min_exponent);
79
79
static_assert (+16'384 == std::numeric_limits<_Real>::max_exponent);
80
- __underflow = __hypot_factors<_Real>{0x1 .0p-8'190l , 0x1 .0p9' 000l, 0x1.0p-9' 000l };
81
- __overflow = __hypot_factors<_Real>{0x1 .0p8' 190l, 0x1.0p-9' 000l , 0x1 .0p+9'000l };
80
+ __underflow = __math:: __hypot_factors<_Real>{0x1 .0p-8'190l , 0x1 .0p9' 000l, 0x1.0p-9' 000l };
81
+ __overflow = __math:: __hypot_factors<_Real>{0x1 .0p8' 190l, 0x1.0p-9' 000l , 0x1 .0p+9'000l };
82
82
}
83
83
}
84
84
return {__underflow, __overflow};
85
85
}
86
86
87
87
template <class _Real >
88
88
_LIBCPP_HIDE_FROM_ABI _Real __hypot (_Real __x, _Real __y, _Real __z) {
89
- const auto [__underflow, __overflow] = __create_factors<_Real>();
89
+ const auto [__underflow, __overflow] = __math:: __create_factors<_Real>();
90
90
_Real __M = std::max ({__math::fabs (__x), __math::fabs (__y), __math::fabs (__z)});
91
91
if (__M > __overflow.__threshold ) { // x*x + y*y + z*z might overflow
92
92
__x *= __overflow.__scale_xyz ;
@@ -103,12 +103,12 @@ _LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) {
103
103
return __M * __math::sqrt (__x * __x + __y * __y + __z * __z);
104
104
}
105
105
106
- inline _LIBCPP_HIDE_FROM_ABI float hypot (float __x, float __y, float __z) { return __hypot (__x, __y, __z); }
106
+ inline _LIBCPP_HIDE_FROM_ABI float hypot (float __x, float __y, float __z) { return __math:: __hypot (__x, __y, __z); }
107
107
108
- inline _LIBCPP_HIDE_FROM_ABI double hypot (double __x, double __y, double __z) { return __hypot (__x, __y, __z); }
108
+ inline _LIBCPP_HIDE_FROM_ABI double hypot (double __x, double __y, double __z) { return __math:: __hypot (__x, __y, __z); }
109
109
110
110
inline _LIBCPP_HIDE_FROM_ABI long double hypot (long double __x, long double __y, long double __z) {
111
- return __hypot (__x, __y, __z);
111
+ return __math:: __hypot (__x, __y, __z);
112
112
}
113
113
114
114
template <class _A1 ,
@@ -119,7 +119,7 @@ _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type hypot(_A1 __x, _A2
119
119
using __result_type = typename __promote<_A1, _A2, _A3>::type;
120
120
static_assert (!(
121
121
std::is_same_v<_A1, __result_type> && std::is_same_v<_A2, __result_type> && std::is_same_v<_A3, __result_type>));
122
- return __hypot (static_cast <__result_type>(__x), static_cast <__result_type>(__y), static_cast <__result_type>(__z));
122
+ return __math:: __hypot (static_cast <__result_type>(__x), static_cast <__result_type>(__y), static_cast <__result_type>(__z));
123
123
}
124
124
#endif
125
125
0 commit comments