Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > A

abs(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

abs(), labs(), llabs(), imaxabs() — return integer absolute value

SYNOPSIS

#include <stdlib.h>

int abs(int i);

long int labs(long int i);

long long llabs(long long i);

#include <inttypes.h>

intmax_t imaxabs(intmax_t i);

DESCRIPTION

abs() computes the absolute value of its integer operand.

labs() computes the absolute value of its long integer operand.

llabs() computes the absolute value of its long long integer operand.

imaxabs() computes the absolute value of its intmax_t integer operand.

If the result value can not be represented, the behavior of these functions is undefined.

RETURN VALUE

abs() returns the absolute value of its integer operand.

labs() returns the absolute value of the long integer operand.

llabs() returns the absolute value of the long long integer operand.

imaxabs() returns the absolute value of the intmax_t integer operand.

The largest negative integer returns itself.

WARNINGS

In two's-complement representation, the absolute value of the negative integer with the largest magnitude can not be represented.

SEE ALSO

imaxdiv(3C), floor(3M), thread_safety(5).

STANDARDS CONFORMANCE

abs(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

labs(): AES, SVID3, XPG4, ANSI C

llabs(): ISO/IEC 9899:1999 (C99), UNIX 03

imaxabs(): ISO/IEC 9899:1999 (C99), UNIX 03

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.