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.

Description: Splits a double precision floating pointvalue into fractional and<br />

integer<br />

parts.<br />

Include: <br />

Prototype: double modf(double x, double *pint);<br />

Arguments: x double precision floating point value<br />

pint pointer to a stored the integer part<br />

Return Value: Returns the signed fractional part and pintpoints to the integer<br />

part.<br />

Remarks: The absolute value of the fractional part is in the range of 0<br />

(inclusive)<br />

to 1 (exclusive). No domainor range error will occur.<br />

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

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

int main(void)<br />

{<br />

double x,y,n;<br />

x = 0.707;<br />

y = modf (x, &n);<br />

printf("For %f the fraction is %f\n ", x, y);<br />

printf(" and the integer is %0.f\n\n", n);<br />

x = -15.2121;<br />

y = modf (x, &n);<br />

printf("For %f the fraction is %f\n ", x, y);<br />

printf(" and the integer is %0.f\n\n", n);<br />

}<br />

Output:<br />

For 0.707000 the fraction is 0.707000<br />

and the integer is 0<br />

For -15.212100 the fraction is -0.212100<br />

and the integer is -15<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 354<br />

modff<br />

2004 Microchip Technology Inc.<br />

Description: Splits a single precision floating point value into fractional and<br />

integer<br />

parts.<br />

Include: <br />

Prototype: float modff(float x, float *pint);<br />

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

2004 Microchip Technology Inc DS51456B trang 357<br />

tội lỗi<br />

Mô tả: Tính hàm lượng giác sin của một độ chính xác kép nổi<br />

giá trị điểm.<br />

Bao gồm:<br />

Prototype: tội lỗi kép (double x);<br />

Đối số: x giá trị mà trả lại sin<br />

Quay trở lại giá trị: Trả về sin xin radian trong phạm vi của -1 đến 1 bao gồm.<br />

Bình luận: Một lỗi miền sẽ xảy ra nếu t XIS một NaN hoặc vô cùng.<br />

Ví dụ: # include / * Tội lỗi * /<br />

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

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

int main (void)<br />

{<br />

double x, y;<br />

errno = 0;<br />

x = -1,0;<br />

y = sin (x);<br />

if (errno)<br />

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

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

errno = 0;<br />

x = 0,0;<br />

y = sin (x);<br />

if (errno)<br />

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

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

}<br />

Đầu ra:<br />

Sin của -1,000000 là -,841471<br />

Sin của 0.000000 là 0.000000<br />

dsPIC<br />

®<br />

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

DS51456B trang 358 2004 Microchip Technology Inc<br />

sinf<br />

Mô tả: Tính hàm lượng giác sin của một độ chính xác đơn nổi<br />

giá trị điểm.

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

Saved successfully!

Ooh no, something went wrong!