Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル
製品コード
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 350
2012 Microchip Technology Inc.
POW
Synopsis
#include <math.h>
double pow (double f, double p)
Description
The
pow()
function raises its first argument,
f
, to the power
p
.
Example
#include <math.h>
#include <stdio.h>
void
main (void)
{
double f;
for(f = 1.0 ; f <= 10.0 ; f += 1.0)
printf("pow(2, %1.0f) = %f\n", f, pow(2, f));
}
See Also
log()
, log10(), exp()
Return Value
f to the power of
p
.
PRINTF, VPRINTF
Synopsis
#include <stdio.h>
int printf (const char * fmt, ...)
#include <stdio.h>
#include <stdarg.h>
int vprintf (const char * fmt, va_list va_arg)
Description
The
printf()
function is a formatted output routine, operating on stdout. It relies on
the putch() function to determine the destination of stdout. The putch() function
must be written as part of each project, as well as code to initialize any peripherals used
by this routine. A stub for putch can be found in the sources directory of the compiler.
must be written as part of each project, as well as code to initialize any peripherals used
by this routine. A stub for putch can be found in the sources directory of the compiler.
A typical putch routine to send one byte to the USART may need to be written similar
to the following.
to the following.
void putch(char data) {
while( ! TXIF)
continue;
TXREG = data;
}
Include the source file for putch into your project once it is complete.