📄 zatan2.c
字号:
/* atan2() * * Quadrant correct inverse circular tangent * * * * SYNOPSIS: * * double x, y, z, atan2(); * * z = atan2( x, y ); * * * * DESCRIPTION: * * Returns radian angle between 0 and +2pi whose tangent * is y/x. * * * * ACCURACY: * * See atan.c. * *//*Cephes Math Library Release 2.0: April, 1987Copyright 1984, 1987 by Stephen L. MoshierDirect inquiries to 30 Frost Street, Cambridge, MA 02140Certain routines from the Library, including this one, maybe used and distributed freely provided this notice is retainedand source code is included with all distributions.*/extern double PI;#if __STDC__double atan (double);#elsedouble atan();#endifdouble zatan2( x, y )double x, y;{double z, w;short code;code = 0;if( x < 0.0 ) code = 2;if( y < 0.0 ) code |= 1;if( x == 0.0 ) { if( code & 1 ) return( 1.5*PI ); if( y == 0.0 ) return( 0.0 ); return( 0.5*PI ); }if( y == 0.0 ) { if( code & 2 ) return( PI ); return( 0.0 ); }switch( code ) { default: case 0: w = 0.0; break; case 1: w = 2.0 * PI; break; case 2: case 3: w = PI; break; }z = atan( y/x );return( w + z );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -