git: b6279be747fa - stable/15 - libc: Improve {,l,ll,imax}div(3) manpages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Feb 2026 13:17:08 UTC
The branch stable/15 has been updated by obiwac:
URL: https://cgit.FreeBSD.org/src/commit/?id=b6279be747facd85eb4490fc874148fede854d03
commit b6279be747facd85eb4490fc874148fede854d03
Author: Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-02-12 14:50:19 +0000
Commit: Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-02-17 13:16:20 +0000
libc: Improve {,l,ll,imax}div(3) manpages
Mainly rename numerator parameter of div(3) and ldiv(3) from num to
numer, and explicitly specify what "numer", "denom", and "rem" mean in
the manpages.
MFC after: 3 days
Obtained from: https://github.com/apple-oss-distributions/libc (partially)
Sponsored by: Klara, Inc.
(cherry picked from commit 0bba277f2223a31e4453ade39be110b1b3aeb1dd)
---
lib/libc/stdlib/div.3 | 14 ++++++++------
lib/libc/stdlib/div.c | 6 +++---
lib/libc/stdlib/imaxdiv.3 | 6 +++---
lib/libc/stdlib/ldiv.3 | 14 ++++++++------
lib/libc/stdlib/ldiv.c | 8 +++-----
lib/libc/stdlib/lldiv.3 | 6 +++---
6 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/lib/libc/stdlib/div.3 b/lib/libc/stdlib/div.3
index 55c1bd107cb7..87b9665684fb 100644
--- a/lib/libc/stdlib/div.3
+++ b/lib/libc/stdlib/div.3
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 14, 2001
+.Dd February 12, 2026
.Dt DIV 3
.Os
.Sh NAME
@@ -38,21 +38,23 @@
.Sh SYNOPSIS
.In stdlib.h
.Ft div_t
-.Fn div "int num" "int denom"
+.Fn div "int numer" "int denom"
.Sh DESCRIPTION
The
.Fn div
function
computes the value
-.Fa num/denom
-and returns the quotient and remainder in a structure named
+.Fa numer Ns / Ns Fa denom
+(numerator/denominator).
+It returns a structure named
.Fa div_t
that contains two
.Vt int
members named
.Va quot
-and
-.Va rem .
+(quotient) and
+.Va rem
+(remainder).
.Sh SEE ALSO
.Xr imaxdiv 3 ,
.Xr ldiv 3 ,
diff --git a/lib/libc/stdlib/div.c b/lib/libc/stdlib/div.c
index 351dca870553..cdc6e1922060 100644
--- a/lib/libc/stdlib/div.c
+++ b/lib/libc/stdlib/div.c
@@ -35,12 +35,12 @@
#include <stdlib.h> /* div_t */
div_t
-div(int num, int denom)
+div(int numer, int denom)
{
div_t r;
- r.quot = num / denom;
- r.rem = num % denom;
+ r.quot = numer / denom;
+ r.rem = numer % denom;
return (r);
}
diff --git a/lib/libc/stdlib/imaxdiv.3 b/lib/libc/stdlib/imaxdiv.3
index 1553a81edae2..9e51c47b53c3 100644
--- a/lib/libc/stdlib/imaxdiv.3
+++ b/lib/libc/stdlib/imaxdiv.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 14, 2001
+.Dd February 12, 2026
.Dt IMAXDIV 3
.Os
.Sh NAME
@@ -39,9 +39,9 @@ The
.Fn imaxdiv
function computes the value of
.Fa numer
-divided by
+(numerator) divided by
.Fa denom
-and returns the stored result in the form of the
+(denominator) and returns the stored result in the form of the
.Vt imaxdiv_t
type.
.Pp
diff --git a/lib/libc/stdlib/ldiv.3 b/lib/libc/stdlib/ldiv.3
index 66abb00d4d6c..c2ab444bdcab 100644
--- a/lib/libc/stdlib/ldiv.3
+++ b/lib/libc/stdlib/ldiv.3
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 3, 2022
+.Dd February 12, 2026
.Dt LDIV 3
.Os
.Sh NAME
@@ -40,21 +40,23 @@
.Sh SYNOPSIS
.In stdlib.h
.Ft ldiv_t
-.Fn ldiv "long num" "long denom"
+.Fn ldiv "long numer" "long denom"
.Sh DESCRIPTION
The
.Fn ldiv
function
computes the value
-.Fa num Ns / Ns Fa denom
-and returns the quotient and remainder in a structure named
+.Fa numer Ns / Ns Fa denom
+(numerator/denominator).
+It returns the quotient and remainder in a structure named
.Vt ldiv_t
that contains two
.Vt long
members named
.Va quot
-and
-.Va rem .
+(quotient) and
+.Va rem
+(remainder).
.Sh SEE ALSO
.Xr div 3 ,
.Xr imaxdiv 3 ,
diff --git a/lib/libc/stdlib/ldiv.c b/lib/libc/stdlib/ldiv.c
index 4c73bcc14af4..4e92c56dd3e2 100644
--- a/lib/libc/stdlib/ldiv.c
+++ b/lib/libc/stdlib/ldiv.c
@@ -35,14 +35,12 @@
#include <stdlib.h> /* ldiv_t */
ldiv_t
-ldiv(long num, long denom)
+ldiv(long numer, long denom)
{
ldiv_t r;
- /* see div.c for comments */
-
- r.quot = num / denom;
- r.rem = num % denom;
+ r.quot = numer / denom;
+ r.rem = numer % denom;
return (r);
}
diff --git a/lib/libc/stdlib/lldiv.3 b/lib/libc/stdlib/lldiv.3
index d1de4e9234e3..783ea3df6554 100644
--- a/lib/libc/stdlib/lldiv.3
+++ b/lib/libc/stdlib/lldiv.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 14, 2001
+.Dd February 12, 2026
.Dt LLDIV 3
.Os
.Sh NAME
@@ -39,9 +39,9 @@ The
.Fn lldiv
function computes the value of
.Fa numer
-divided by
+(numerator) divided by
.Fa denom
-and returns the stored result in the form of the
+(denominator) and returns the stored result in the form of the
.Vt lldiv_t
type.
.Pp