30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

Output:<br />

The cosine of -1.000000 is 0.540302<br />

The cosine of 0.000000 is 1.000000<br />

cosf<br />

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

floating point value.<br />

Include: <br />

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

Argument: x value for which toreturn the cosine<br />

Return Value: Returns the cosine of xin radians in the ranges of -1 to 1<br />

inclusive.<br />

Remarks: A domain error will occur if xis a NaN or infinity.<br />

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

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

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

int main(void)<br />

{<br />

float x, y;<br />

errno = 0;<br />

y = exp (x);<br />

if (errno)<br />

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

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

errno = 0;<br />

x = -1E3;<br />

y = exp (x);<br />

if (errno)<br />

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

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

}<br />

Đầu ra:<br />

Các mũ của 1.000000 là 2.718282<br />

Lỗi: lỗi phạm vi<br />

Các mũ của 1000.000000 là inf<br />

Lỗi: lỗi phạm vi<br />

Các mũ của -1000,000000 là 0.000000<br />

dsPIC<br />

®<br />

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

x = -1.0F;<br />

y = cosf (x);<br />

DS51456B trang 338<br />

expf<br />

2004 Microchip Technology Inc<br />

if (errno)<br />

perror("Error");<br />

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

errno = 0;<br />

x = 0.0F;<br />

y = cosf (x);<br />

if (errno)<br />

perror("Error");<br />

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

}<br />

Output:<br />

The cosine of -1.000000 is 0.540302<br />

The cosine of 0.000000 is 1.000000<br />

cos (Continued)<br />

Standard C Libraries with Math Functions<br />

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

cosh<br />

Mô tả: Tính hàm mũ của x (e lũy thừa x nơi<br />

x là độ chính xác đơn giá trị nổi điểm).<br />

Bao gồm:<br />

Prototype: expf nổi (float x);<br />

Đối số: x nổi giá trị điểm mà trả lại theo cấp số nhân<br />

Quay trở lại giá trị: Trả về số mũ của x. Trên một tràn, expfreturns infand trên<br />

một điểm kinh nghiệm Van cân bằng trả về 0.<br />

Bình luận: Một loạt lỗi xảy ra nếu độ lớn của XIS quá lớn.<br />

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

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

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

int main (void)<br />

{<br />

float x, y;<br />

errno = 0;<br />

x = 1.0f;<br />

y = expf (x);

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

Saved successfully!

Ooh no, something went wrong!