Skip to content

Commit e8c8555

Browse files
[libc++] Fix return type of ilogb(double) (#19755)
This commit addresses a seemingly unintentional return type of the ilogb overload taking a double. Currently it returns double, while it is supposed to return int. The return types seems to be covered by libcxx/test/std/numerics/c.math/cmath.pass.cpp, but the issue would only show up if we tested with a libc that doesn't provide the ilogb(double) overload, which we don't. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 0d06954 commit e8c8555

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libcxx/include/__cxx03/__math/logarithms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ inline _LIBCPP_HIDE_FROM_ABI double log10(_A1 __x) _NOEXCEPT {
5858
inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT { return __builtin_ilogbf(__x); }
5959

6060
template <class = int>
61-
_LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT {
61+
_LIBCPP_HIDE_FROM_ABI int ilogb(double __x) _NOEXCEPT {
6262
return __builtin_ilogb(__x);
6363
}
6464

libcxx/include/__math/logarithms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ inline _LIBCPP_HIDE_FROM_ABI double log10(_A1 __x) _NOEXCEPT {
5858
inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT { return __builtin_ilogbf(__x); }
5959

6060
template <class = int>
61-
_LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT {
61+
_LIBCPP_HIDE_FROM_ABI int ilogb(double __x) _NOEXCEPT {
6262
return __builtin_ilogb(__x);
6363
}
6464

0 commit comments

Comments
 (0)