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 (Volume 6 of 9): Section 3: Library Functions (A-M) > a

abs(3C)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

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

SYNOPSIS

#include <stdlib.h>

int abs(int i);

long int labs(long int i);

DESCRIPTION

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

labs() is similar to abs(), except that the argument and the returned value each have type long int.

The largest negative integer returns itself.

APPLICATION USAGE

The interfaces abs() and labs() are thread-safe and async-cancel-safe.

WARNINGS

In two's-complement representation, the absolute value of the negative integer with largest magnitude is undefined. Some implementations trap this error, but others simply ignore it.

SEE ALSO

floor(3M).

STANDARDS CONFORMANCE

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

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

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