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

製品コード
SW006021-1
ページ / 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 318
 2012 Microchip Technology Inc.
Example
#include <stdio.h>
#include <stdlib.h>
void
main (void)
{
    int a = -5;
    printf(“The absolute value of %d is %d\n”, a, abs(a));
}
See Also
labs()
, fabs()
Return Value
The absolute value of j.
ACOS 
Synopsis
#include <math.h>
 
double acos (double f)
Description
The acos() function implements the inverse of cos(); i.e., it is passed a value in the 
range -1 to +1, and returns an angle in radians whose cosine is equal to that value.
Example
#include <math.h>
#include <stdio.h>
/* Print acos() values for -1 to 1 in degrees. */
void 
main (void)
{
    float i, a;
    for(i = -1.0; i < 1.0 ; i += 0.1) {
        a = acos(i)*180.0/3.141592;
        printf(“acos(%f) = %f degrees\n”, i, a);
    }
}
See Also
sin()
, cos(), tan(), asin(), atan(), atan2()
Return Value
An angle in radians, in the range 0 to