C++ Reference: Standard C++ Library reference: C Library: cmath: tan

发布于:2022-12-07 ⋅ 阅读:(810) ⋅ 点赞:(0)

C++官网参考链接:https://cplusplus.com/reference/cmath/tan/

函数 
<cmath> <ctgmath>
tan 

C90
double tan (double x);
C99
double tan  (double x); 
float tanf (float x);
long double tanl (long double x);
C++98
double tan (double x);      
float tan (float x);
long double tan (long double x);
C++11
double tan (double x);      
float tan (float x);
long double tan (long double x);     
double tan (T x);  // additional overloads for integral types

计算正切 
返回x弧度角的正切值。

C99
头文件<tgmath.h>提供了该函数的泛型类型的宏版本。 
C++98
该函数在头文件<complex><valarray>中重载(参见complex tanvalarray tan)。 
C++11
在此头文件(<cmath>)中为整型(integral types)提供了额外的重载:这些重载在计算之前有效地将x转换为double类型(定义T为任何整型(integral type))。
此函数在<complex><valarray>中也被重载(参见complex tanvalarray tan)。 

形参
x
表示以弧度表示的角度值。
1弧度等于180/PI度。

返回值
x弧度的正切。

用例
/* tan example */
#include <stdio.h>      /* printf */
#include <math.h>       /* tan */

#define PI 3.14159265

int main ()
{
  double param, result;
  param = 45.0;
  result = tan ( param * PI / 180.0 );
  printf ("The tangent of %f degrees is %f.\n", param, result );
  return 0;
}
输出:

本文含有隐藏内容,请 开通VIP 后查看

网站公告

今日签到

点亮在社区的每一天
去签到