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.

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

volatile int i;<br />

int main(void)<br />

{<br />

time_t ticks;<br />

time(0); /* start time */<br />

for (i = 0; i < 10; i++) /* waste time */<br />

time(&ticks); /* get time */<br />

printf("Time = %ld\n", ticks);<br />

}<br />

Output:<br />

Time = 256<br />

Standard C Libraries with Math Functions<br />

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

4.17 MATHEMATICAL FUNCTIONS<br />

giá trị dấu chấm động.<br />

Bao gồm:<br />

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

Giá trị x giữa -1 và 1: Đối số<br />

Quay trở lại giá trị: Trả về sin hồ quang trong radian trong khoảng -pi / 2 đến +<br />

pi / 2 (bao gồm).<br />

Bình luận: Một lỗi xảy ra nếu miền XIS ít hơn 1 hoặc lớn hơn 1.<br />

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

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

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

int main (void)<br />

{<br />

float x, y;<br />

dsPIC<br />

®<br />

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

The header file math.hconsists of a macro and various functions that calculate<br />

common mathematical operations. Error conditions may be handled with a<br />

domain error or<br />

range error (see errno.h).<br />

DS51456B trang 328<br />

errno = 0;<br />

x = 2.0F;<br />

2004 Microchip Technology Inc<br />

A domain error occurs when the input argument is outside the domain over<br />

which the<br />

function is defined. The error is reported by storing the value of EDOMin<br />

errnoand<br />

returning a particular value defined for each function.<br />

A range error occurs when the result is too large or too small to be represented<br />

in the<br />

target precision. The error is reported by storing the value of ERANGEin<br />

errnoand<br />

returning HUGE_VALif the result overflowed (return value was too large) or a<br />

zero if the<br />

result underflowed (return value is too small).<br />

Responses to special values, such as NaNs, zeros, and infinities, may vary<br />

depending<br />

upon the function. Each function description includes a definition of the<br />

function's<br />

response to such values.<br />

HUGE_VAL<br />

Description: HUGE_VALis returned by a function on a range error (e. g., the<br />

function<br />

tries to return a value too large to be represented in the target<br />

precision).<br />

Include: <br />

Remarks: -HUGE_VALis returned if a function result is negative and is too<br />

large<br />

y = asinf (x);<br />

if (errno)<br />

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

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

errno = 0;<br />

x = 0.0f;<br />

y = asinf (x);<br />

if (errno)<br />

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

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

}<br />

Đầu ra:<br />

Lỗi: lỗi miền<br />

Các arcsine của 2.000000 là nan<br />

Các arcsine của 0.000000 là 0.000000<br />

atan<br />

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

giá trị dấu chấm động.<br />

Bao gồm:<br />

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

Đối số: x giá trị mà trả lại tang cung

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

Saved successfully!

Ooh no, something went wrong!