非常教程

C参考手册

数值 | Numerics

catan

在头文件<math.h>中定义

float complex catanf( float complex z );

(1)

(since C99)

double complex catan( double complex z );

(2)

(since C99)

long double complex catanl( long double complex z );

(3)

(since C99)

Defined in header <tgmath.h>

#define atan( z )

(4)

(since C99)

1-3)计算在z沿虚轴的间隔-i,+ i之外的分支切口的复数反正切。

4)类型 - 通用宏:如果z有类型long double complexcatanl被调用。如果z有类型double complexcatan称为,如果z有类型float complexcatanf称为。如果z是真实的或整数,则宏调用相应的实函数(atanfatanatanl)。如果z是虚构的,那么宏调用函数的相应实际版本atanh,实现公式atan(iy)= i atanh(y),并且宏的返回类型是虚构的。

参数

z

-

复杂的论点

返回值

如果没有出现错误,z则在沿虚轴无界且在-π/ 2区间内的条带范围内返回复正切正切; +π/ 2沿实轴。

错误和特殊情况被处理,就像操作被执行一样-I * catanh(I*z)

笔记

反正切(或反正切)是一种多值函数,需要在复平面上进行分支切割。通常将分支切口放置在虚轴的线段(-∞i,-i)和(+ i,+∞i)处。反正切的主值的数学定义是atan z = -

| 1 |

|:----|

| 2 |

i ln(1 - iz) - ln (1 + iz

#include <stdio.h>
#include <float.h>
#include <complex.h>
 
int main(void)
{
    double complex z = catan(2*I);
    printf("catan(+0+2i) = %f%+fi\n", creal(z), cimag(z));
 
    double complex z2 = catan(-conj(2*I)); // or CMPLX(-0.0, 2)
    printf("catan(-0+2i) (the other side of the cut) = %f%+fi\n", creal(z2), cimag(z2));
 
    double complex z3 = 2*catan(2*I*DBL_MAX); // or CMPLX(0, INFINITY)
    printf("2*catan(+0+i*Inf) = %f%+fi\n", creal(z3), cimag(z3));
}

输出:

catan(+0+2i) = 1.570796+0.549306i
catan(-0+2i) (the other side of the cut) = -1.570796+0.549306i
2*catan(+0+i*Inf) = 3.141593+0.000000i

参考

  • C11标准(ISO / IEC 9899:2011):
    • 7.3.5.3 catan函数(p:191)
    • 7.25类型通用数学<tgmath.h>(p:373-375)
    • G.7类型 - 通用数学<tgmath.h>(p:545)
  • C99标准(ISO / IEC 9899:1999):
    • 7.3.5.3 catan函数(p:173)
    • 7.22类型通用数学<tgmath.h>(p:335-337)
    • G.7类型 - 通用数学<tgmath.h>(p:480)
C

C 语言是一门通用计算机编程语言,应用广泛。C 语言的设计目标是提供一种能以简易的方式编译、处理低级存储器、产生少量的机器码以及不需要任何运行环境支持便能运行的编程语言。