30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Description: Calculates the trigonometric arc cosine function of a single<br />

precision<br />

floating-point value.<br />

Include: <br />

Prototype: float acosf (float x);<br />

Argument: x value between -1 and 1<br />

Return Value: Returns the arc cosine in radians in the range of0 to pi<br />

(inclusive).<br />

Remarks: A domain error occurs if xis less than -1 or greater than 1.<br />

Example: #include /* for acosf */<br />

#include /* for printf, perror */<br />

#include /* for errno */<br />

int main(void)<br />

{<br />

float x, y;<br />

errno = 0;<br />

x = 2.0F;<br />

y = acosf (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The arccosine of %f is %f\n\n", x, y);<br />

errno = 0;<br />

x = 0.0F;<br />

y = acosf (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The arccosine of %f is %f\n", x, y);<br />

}<br />

Output:<br />

Error: domain error<br />

The arccosine of 2.000000 is nan<br />

The arccosine of 0.000000 is 1.570796<br />

acos (Continued)<br />

Standard C Libraries with Math Functions<br />

2004 Microchip Technology Inc. DS51456B-page 327<br />

asin<br />

Description: Calculates the trigonometric arc sine function of a double precision<br />

floating-point value.<br />

Include: <br />

Prototype: double asin (double x);<br />

x = -1.0F;<br />

y = atanf (x);<br />

printf ("arctangent của% f% f \ n \ n", x, y);<br />

}<br />

Đầu ra:<br />

Các arctangent của 2.000000 là 1.107149<br />

Các arctangent của -1,000000 là -,785398<br />

atan2<br />

Mô tả: Tính hàm lượng giác cung tiếp tuyến của y / x.<br />

Bao gồm:<br />

Prototype: atan2 đôi (double y, double x);<br />

Đối số: giá trị yy mà trả lại tang cung<br />

giá trị xx mà trả lại tang cung<br />

Quay trở lại giá trị: Trả về inradians hồ quang tiếp xúc trong khoảng từ-pi pi<br />

(bao gồm)<br />

với góc tọa độ được xác định bởi các dấu hiệu của cả hai tham số.<br />

Bình luận: Một lỗi xảy ra nếu cả hai miền xand Yare không hoặc cả hai xand<br />

Yare<br />

+/- Vô cùng.<br />

Ví dụ: # include / * Cho atan2 * /<br />

# include / * Cho printf, perror * /<br />

# include / * Cho errno * /<br />

int main (void)<br />

{<br />

double x, y, z;<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

DS51456B trang 330<br />

errno = 0;<br />

x = 0,0;<br />

y = 2,0;<br />

z = atan2 (x, y);<br />

if (errno)<br />

perror ("Lỗi");<br />

2004 Microchip Technology Inc<br />

printf ("arctangent của% f / f% là% f \ n \ n",<br />

x, y, z);<br />

errno = 0;<br />

x = -1,0;<br />

y = 0.0;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!