---
name: "abs"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/abs"
---

# abs(3)

return absolute value for integer types

## NAME

**abs**, **labs**, **llabs**, **imaxabs** – return absolute value for integer types

## SYNOPSIS

Standard C Library (libc, -lc)

**#include \<stdlib.h\>**

*int*\

**abs**(*int i*);

*long*\

**labs**(*long i*);

*long* *long*\

**llabs**(*long long i*);

**#include \<inttypes.h\>**

*intmax\_t*\

**imaxabs**(*intmax\_t i*);

## DESCRIPTION

The **abs**(), **labs**(), **llabs**(), and **imaxabs**() functions compute the absolute value of *i*.

## RETURN VALUES

The **abs**(), **labs**(), **llabs**(), and **imaxabs**() functions return the absolute value.

## SEE ALSO

[cabs(3)](/cabs/3.md), [fabs(3)](/fabs/3.md), [floor(3)](/floor/3.md), [hypot(3)](/hypot/3.md)

## STANDARDS

The **abs**(), **labs**(), **llabs**(), and **imaxabs**() functions conform to ISO/IEC 9899:2024 (“ISO C23”) and IEEE Std 1003.1-2024 (“POSIX.1”).

## HISTORY

The **abs**() function first appeared in Version 6 AT&T UNIX. The **labs**() function first appeared in 4.3BSD. The **llabs**() and **imaxabs**() functions first appeared in FreeBSD 5.0.

## BUGS

The absolute value of the most negative integer remains negative.
