Calculates the angle atan2 (double y,double x) between the calculated point and the x-axis positive half axis, returning the Radian system (-PI,PI]

Source: Internet
Author: User

The accuracy is higher than ACOs, ASIN what.

Parameters
Y
Value representing the proportion of the y-coordinate.
X
Value representing the proportion of the x-coordinate.

If both arguments passed is zero, a domain error occurs.

So just remove the x=y=0 before use

Example:

/*atan2 Example*/#include<stdio.h>/*printf*/#include<math.h>/*atan2*/#definePI 3.14159265intMain () {Doublex, y, result; X= -10.0; Y=10.0; Result= atan2 (y,x) * the/PI; printf ("The arc tangent for (x=%f, y=%f) is%f degrees\n", x, y, result); return 0;}

Results:

 for (x=-10.000000, y=10.000000is135.000000 degrees.

The return value is an example of (-pi,pi]

printf ("%lf", atan2 (0,-1) *P/PI); output:  180.000000

Calculates the angle atan2 (double y,double x) between the calculated point and the x-axis positive half axis, returning the Radian system (-PI,PI]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.