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.

Example: #include /* for strftime, */<br />

/* localtime, */<br />

/* time_t, tm */<br />

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

int main(void)<br />

{<br />

time_t timer, whattime;<br />

struct tm *newtime;<br />

char buf[128];<br />

timer = 1066668182; /* Mon Oct 20 16:43:02 2003 */<br />

/* localtime allocates space for structure */<br />

newtime = localtime(&timer);<br />

strftime(buf, 128, "It was a %A, %d days into the "<br />

"month of %B in the year %Y.\n", newtime);<br />

printf(buf);<br />

strftime(buf, 128, "It was %W weeks into the year "<br />

"or %jdays into the year.\n", newtime);<br />

printf(buf);<br />

}<br />

Output:<br />

It was a Monday, 20 days into the month of October in<br />

the year 2003.<br />

It was 42 weeks into the year or 293 days into the<br />

year.<br />

strftime (Continued)<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

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

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

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

acos (Tiếp theo)<br />

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

2004 Microchip Technology Inc DS51456B trang 327<br />

asin<br />

Mô tả: Tính hàm sin cung 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: asin đôi (double x);<br />

Đối số: giá trị x giữa -1 và 1 mà trả lại arc sine<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 asin * /<br />

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

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

int main (void)<br />

{<br />

double x, y;<br />

errno = 0;<br />

x = 2,0;<br />

y = asin (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,0;<br />

DS51456B-page 324<br />

time<br />

2004 Microchip Technology Inc.<br />

y = asin (x);<br />

if (errno)<br />

Description: Calculates the current calendar time.<br />

Include: <br />

Prototype: time_t time(time_t *tod);<br />

Argument: tod pointer to storage location for time<br />

Return Value: Returns the calendar time encoded as a value of time_t.<br />

Remarks: If the target environment cannot determine the time, the function<br />

returns -1, cast as a time_t. By default, MPLAB C30 returns the time<br />

as instruction cycles. This function is customizable. See pic30-libs.<br />

Example: #include /*for time */<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 />

asinf<br />

Mô tả: Tính hàm sin cung lượng giác của một độ chính xác đơn

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

Saved successfully!

Ooh no, something went wrong!