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 hyperbolic cosine function of a double precision<br />

floating<br />

point value.<br />

Include: <br />

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

Argument: x value for which to return the hyperbolic cosine<br />

Return Value: Returns the hyperbolic cosine of x<br />

Remarks: A range error will occur if the magnitude of xis too large.<br />

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

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

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

int main(void)<br />

{<br />

double x, y;<br />

errno = 0;<br />

x = -1.5;<br />

y = cosh (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The hyperbolic cosine of %f is %f\n\n",<br />

x, y);<br />

errno = 0;<br />

x = 0.0;<br />

y = cosh (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The hyperbolic cosine of %f is %f\n\n",<br />

x, y);<br />

errno = 0;<br />

x = 720.0;<br />

y = cosh (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The hyperbolic cosine of %f is %f\n\n",<br />

x, y);<br />

}<br />

Output:<br />

The hyperbolic cosine of-1.500000 is 2.352410<br />

The hyperbolic cosine of0.000000 is 1.000000<br />

if (errno)<br />

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

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

errno = 0;<br />

x = 1.0E3F;<br />

y = expf (x);<br />

if (errno)<br />

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

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

errno = 0;<br />

x = -1.0E3F;<br />

y = expf (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 />

Thư viện chuẩn C với hàm toán học<br />

2004 Microchip Technology Inc DS51456B trang 339<br />

fabs<br />

Mô tả: Tính giá trị tuyệt đối của một giá trị chính xác điểm nổi gấp đôi.<br />

Bao gồm:<br />

Prototype: fabs đôi (double x);<br />

Đối số: x nổi giá trị điểm mà toreturn giá trị tuyệt đối<br />

Quay trở lại giá trị: Trả về giá trị tuyệt đối của x. (Một số âm được trả về như<br />

tích cực, một số dương là không thay đổi.)<br />

Bình luận: Không có tên miền hoặc rangeerror sẽ xảy ra.<br />

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

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

int main (void)<br />

{<br />

double x, y;<br />

x = 1,75;<br />

y = fabs (x);

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

Saved successfully!

Ooh no, something went wrong!