Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 340
 2012 Microchip Technology Inc.
Return Value
This routine returns a copy of the buffer into which the result is written.
LABS 
Synopsis
#include <stdlib.h>
 
int labs (long int j)
Description
The 
labs()
 function returns the absolute value of long value 
j
.
Example
#include <stdio.h>
#include <stdlib.h>
void 
main (void)
{
    long int a = -5;
    printf("The absolute value of %ld is %ld\n", a, labs(a));
}
See Also
abs()
Return Value
The absolute value of 
j
.
LDEXP 
Synopsis
#include <math.h>
 
double ldexp (double f, int i)
Description
The 
ldexp()
 function performs the inverse of frexp() operation; the integer 
i
 is 
added to the exponent of the floating-point 
f
 and the resultant returned.
Example
#include <math.h>
#include <stdio.h>
void 
main (void)
{
    double f;
    f = ldexp(1.0, 10);
    printf("1.0 * 2^10 = %f\n", f);
}
See Also
frexp()