Changeset View
Changeset View
Standalone View
Standalone View
libcxx/include/__cmath/frexp.h
- This file was added.
//===----------------------------------------------------------------------===// | |||||
// | |||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |||||
// See https://llvm.org/LICENSE.txt for license information. | |||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |||||
// | |||||
//===----------------------------------------------------------------------===// | |||||
#ifndef _LIBCPP___CMATH_FREXP_H | |||||
#define _LIBCPP___CMATH_FREXP_H | |||||
#include <__config> | |||||
#include <__type_traits/enable_if.h> | |||||
#include <__type_traits/is_floating_point.h> | |||||
#include <__type_traits/is_integral.h> | |||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |||||
# pragma GCC system_header | |||||
#endif | |||||
_LIBCPP_BEGIN_NAMESPACE_STD | |||||
inline _LIBCPP_HIDE_FROM_ABI float frexp(float __x, int* __exp) _NOEXCEPT { return __builtin_frexpf(__x, __exp); } | |||||
template <class = int> | |||||
_LIBCPP_HIDE_FROM_ABI double frexp(double __x, int* __exp) _NOEXCEPT { | |||||
return __builtin_frexp(__x, __exp); | |||||
} | |||||
inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __exp) _NOEXCEPT { | |||||
return __builtin_frexpl(__x, __exp); | |||||
} | |||||
template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0> | |||||
_LIBCPP_HIDE_FROM_ABI double frexp(_Tp __x, int* __exp) _NOEXCEPT { | |||||
return __builtin_frexp(static_cast<double>(__x), __exp); | |||||
} | |||||
_LIBCPP_END_NAMESPACE_STD | |||||
using std::frexp; | |||||
#endif // _LIBCPP___CMATH_FREXP_H |