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.

errno = 0;<br />

x = -1E3;<br />

y = exp (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The exponential of %f is %f\n\n", x, y);<br />

}<br />

Output:<br />

The exponential of 1.000000 is 2.718282<br />

Error: range error<br />

The exponential of 1000.000000 is inf<br />

Error: range error<br />

The exponential of -1000.000000 is 0.000000<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 338<br />

expf<br />

2004 Microchip Technology Inc.<br />

Description: Calculates the exponential function of x (e raised to the power x<br />

where<br />

x is a single precision floating point value).<br />

Include: <br />

Prototype: float expf (float x);<br />

Argument: x floating point value for which to return the exponential<br />

Return Value: Returns the exponential of x. On an overflow, expfreturns infand<br />

on<br />

an underflow exp returns 0.<br />

Remarks: A range error occurs if the magnitude of xis too large.<br />

Example: #include /* for expf */<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 = expf (x);<br />

if (errno)<br />

perror("Error");<br />

printf("The exponential of %f is %f\n\n", x, y);<br />

nổi x [8] = {2.0F, 1.75F, 1.5F, 1.25F,<br />

-2.0F, -1.75F, -1.5F, -1.25F};<br />

nổi y;<br />

int i;<br />

for (i = 0; i

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

Saved successfully!

Ooh no, something went wrong!