User manual
Library Functions
2012 Microchip Technology Inc. DS52053B-page 359
Description
The sprintf() function operates in a similar fashion to printf(), except that instead
of placing the converted output on the stdout stream, the characters are placed in the
buffer at
buf. The resultant string will be null terminated, and the number of characters
in the buffer will be returned.
The
vsprintf() function is similar to sprintf() but takes a variable argument list
parameter rather than a list of arguments. See the description of va_start() for more
information on variable argument lists.
See Also
printf(), sscanf()
Return Value
Both these routines return the number of characters placed into the buffer.
SQRT
Synopsis
#include <math.h>
double sqrt (double f)
Description
The function sqrt(), implements a square root routine using Newton’s approximation.
Example
#include <math.h>
#include <stdio.h>
void
main (void)
{
double i;
for(i = 0 ; i <= 20.0 ; i += 1.0)
printf("square root of %.1f = %f\n", i, sqrt(i));
}
See Also
exp()
Return Value
Returns the value of the square root.
Note
A domain error occurs if the argument is negative and errno will be set to EDOM.