English
Language : 

CC78K0S Datasheet, PDF (222/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 10 LIBRARY FUNCTIONS
5-9 abs
labs
Utility Functions
FUNCTION
The mathematical function abs returns the absolute value of its int type argument.
The mathematical function labs returns the absolute value of its long type argument.
HEADER
stdlib.h
FUNCTION PROTOTYPE
int abs(int j);
long int labs(long int j);
Function
abs
Arguments
j ... Absolute value to be
obtained
labs
Return Value
• Absolute value of j if j falls
within:
–32767 ≤ j ≤ 32767
• –32768 (0x8000) if j is
–32768
• Absolute value of j if j falls
within
–2147483647 ≤ j ≤
2147483647
• –2147483648
(0x80000000) if the value of
j is –2147483648
EXPLANATION
abs
• The abs returns the absolute value of its int type argument.
• If j is –32768, the function returns –32768.
labs
• The labs returns the absolute value of its long type argument.
• If the value of j is –2147483648, the function returns –2147483648.
222
User’s Manual U14872EJ1V0UM