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.

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

pint pointer to stored 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 modff */<br />

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

int main(void)<br />

{<br />

float x,y,n;<br />

x = 0.707F;<br />

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

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

Standard C Libraries with Math Functions<br />

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

pow<br />

Description: Calculates x raised to the power y.<br />

Include: <br />

Prototype: double pow(double x, double y);<br />

Arguments: x the base<br />

ythe exponent<br />

Return Value: Returns xraised to the power y(x^y).<br />

Remarks: If yis 0 powreturns 1. If xis 0.0 and yis less than 0 powreturns inf<br />

and a domain error occurs. If the result overflows or underflows, a<br />

range error occurs.<br />

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

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

Bao gồm:<br />

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

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

Quay trở lại giá trị: Trả về tội 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 XIS một NaN hoặc vô cùng.<br />

Ví dụ: # include / * Cho sinf * /<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 = sinf (x);<br />

if (errno)<br />

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

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

errno = 0;<br />

x = 0.0f;<br />

y = sinf (x);<br />

if (errno)<br />

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

printf ("sin của% f% 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 />

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

2004 Microchip Technology Inc DS51456B trang 359<br />

sinh<br />

Mô tả: Tính hàm sin hyperbol của một độ chính xác gấp đôi nổi<br />

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

Bao gồm:<br />

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

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

Quay trở lại giá trị: Trả về sin hyperbol của x<br />

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

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

# include / * Cho printf, perror * /

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

Saved successfully!

Ooh no, something went wrong!