11541Srgrimes//===----------------------------------------------------------------------===// 21541Srgrimes// 31541Srgrimes// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 41541Srgrimes// See https://llvm.org/LICENSE.txt for license information. 51541Srgrimes// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61541Srgrimes// 71541Srgrimes//===----------------------------------------------------------------------===// 81541Srgrimes 91541Srgrimes#ifndef _LIBCPP___MATH_TRIGONOMETRIC_FUNCTIONS_H 101541Srgrimes#define _LIBCPP___MATH_TRIGONOMETRIC_FUNCTIONS_H 111541Srgrimes 121541Srgrimes#include <__config> 131541Srgrimes#include <__type_traits/enable_if.h> 141541Srgrimes#include <__type_traits/is_integral.h> 151541Srgrimes 161541Srgrimes#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 171541Srgrimes# pragma GCC system_header 181541Srgrimes#endif 191541Srgrimes 201541Srgrimes_LIBCPP_BEGIN_NAMESPACE_STD 211541Srgrimes 221541Srgrimesnamespace __math { 231541Srgrimes 241541Srgrimes// cos 251541Srgrimes 261541Srgrimesinline _LIBCPP_HIDE_FROM_ABI float cos(float __x) _NOEXCEPT { return __builtin_cosf(__x); } 271541Srgrimes 281541Srgrimestemplate <class = int> 291541Srgrimes_LIBCPP_HIDE_FROM_ABI double cos(double __x) _NOEXCEPT { 301541Srgrimes return __builtin_cos(__x); 311541Srgrimes} 321541Srgrimes 331541Srgrimesinline _LIBCPP_HIDE_FROM_ABI long double cos(long double __x) _NOEXCEPT { return __builtin_cosl(__x); } 341541Srgrimes 351541Srgrimestemplate <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> 361541Srgrimesinline _LIBCPP_HIDE_FROM_ABI double cos(_A1 __x) _NOEXCEPT { 371541Srgrimes return __builtin_cos((double)__x); 381541Srgrimes} 3950477Speter 401541Srgrimes// sin 411541Srgrimes 4213203Swollmaninline _LIBCPP_HIDE_FROM_ABI float sin(float __x) _NOEXCEPT { return __builtin_sinf(__x); } 4313203Swollman 441541Srgrimestemplate <class = int> 452112Swollman_LIBCPP_HIDE_FROM_ABI double sin(double __x) _NOEXCEPT { 4669664Speter return __builtin_sin(__x); 4776166Smarkm} 4889316Salfred 491541Srgrimesinline _LIBCPP_HIDE_FROM_ABI long double sin(long double __x) _NOEXCEPT { return __builtin_sinl(__x); } 501541Srgrimes 511541Srgrimestemplate <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> 521541Srgrimesinline _LIBCPP_HIDE_FROM_ABI double sin(_A1 __x) _NOEXCEPT { 531541Srgrimes return __builtin_sin((double)__x); 541541Srgrimes} 551541Srgrimes 561541Srgrimes// tan 571541Srgrimes 5892751Sjeffinline _LIBCPP_HIDE_FROM_ABI float tan(float __x) _NOEXCEPT { return __builtin_tanf(__x); } 5932011Sbde 601541Srgrimestemplate <class = int> 6169664Speter_LIBCPP_HIDE_FROM_ABI double tan(double __x) _NOEXCEPT { 6269664Speter return __builtin_tan(__x); 6392751Sjeff} 6469664Speter 6569664Speterinline _LIBCPP_HIDE_FROM_ABI long double tan(long double __x) _NOEXCEPT { return __builtin_tanl(__x); } 6669664Speter 6769664Spetertemplate <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> 6892654Sjeffinline _LIBCPP_HIDE_FROM_ABI double tan(_A1 __x) _NOEXCEPT { 6992654Sjeff return __builtin_tan((double)__x); 7069664Speter} 7169664Speter 7269664Speter} // namespace __math 7369664Speter 7469664Speter_LIBCPP_END_NAMESPACE_STD 751541Srgrimes 761541Srgrimes#endif // _LIBCPP___MATH_TRIGONOMETRIC_FUNCTIONS_H 771541Srgrimes