Page MenuHomeFreeBSD

libc: Roll {l,ll,imax}abs(3) manpages into just abs(3)
ClosedPublic

Authored by obiwac on Thu, Feb 19, 3:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Feb 20, 11:10 PM
Unknown Object (File)
Fri, Feb 20, 9:32 PM
Unknown Object (File)
Fri, Feb 20, 9:03 PM
Subscribers

Details

Summary

No need to have 4 separate manpages for these functions. Use opportunity
to change parameter names in the source from j -> i to reflect the name
used in POSIX. (The ISO C standard uses j but i is a better name
anyway.)

Sponsored by: Klara, Inc.

Test Plan

Rendered manpage contents:

ABS(3)                  FreeBSD Library Functions Manual                  ABS(3)

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

SYNOPSIS
     /* -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), fabs(3), floor(3), hypot(3)

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.

FreeBSD 16.0-CURRENT            February 19, 2026                         ABS(3)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

use posix 2024 as standard

des requested changes to this revision.Sat, Feb 21, 12:22 PM
des added inline comments.
lib/libc/stdlib/abs.3
92

Missing: labs() first appeared in .Bx 4.3.

This revision now requires changes to proceed.Sat, Feb 21, 12:22 PM
obiwac edited the test plan for this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Sat, Feb 21, 11:23 PM
This revision was automatically updated to reflect the committed changes.