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.

Error: range error<br />

The hyperbolic cosine of 720.000000 is inf<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 336<br />

coshf<br />

2004 Microchip Technology Inc.<br />

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

floating<br />

point value.<br />

Include: <br />

Prototype: float coshf (float 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 coshf */<br />

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

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

int main(void)<br />

{<br />

float x, y;<br />

errno = 0;<br />

x = -1.0F;<br />

y = coshf (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.0F;<br />

y = coshf (x);<br />

if (errno)<br />

perror("Error");<br />

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

printf ("Giá trị tuyệt đối của% f% f \ n", x, y);<br />

x = -1,5;<br />

y = fabs (x);<br />

printf ("Giá trị tuyệt đối của% f% f \ n", x, y);<br />

}<br />

Đầu ra:<br />

Giá trị tuyệt đối là 1.750000 1.750000<br />

Giá trị tuyệt đối của -1,500000 là 1,500000<br />

fabsf<br />

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

Bao gồm:<br />

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

Đối số: x nổi giá trị điểm mà trở về 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 fabsf * /<br />

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

int main (void)<br />

{<br />

float x, y;<br />

x = 1.75F;<br />

y = fabsf (x);<br />

printf ("Giá trị tuyệt đối của% f% f \ n", x, y);<br />

x = -1.5F;<br />

y = fabsf (x);<br />

printf ("Giá trị tuyệt đối của% f% f \ n", x, y);<br />

}<br />

Đầu ra:<br />

Giá trị tuyệt đối là 1.750000 1.750000<br />

Giá trị tuyệt đối của -1,500000 là 1,500000<br />

dsPIC<br />

®<br />

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

x, y);<br />

errno = 0;<br />

DS51456B trang 340<br />

sàn<br />

2004 Microchip Technology Inc<br />

x = 720.0F;<br />

y = coshf (x);<br />

if (errno)<br />

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

Bao gồm:<br />

Prototype: Tầng đôi (double x);

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

Saved successfully!

Ooh no, something went wrong!