aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Wibo <obiwac@FreeBSD.org>2026-02-12 14:50:19 +0000
committerAymeric Wibo <obiwac@FreeBSD.org>2026-02-12 14:55:14 +0000
commit0bba277f2223a31e4453ade39be110b1b3aeb1dd (patch)
tree93cbc2851165feee6e5cce96470622c1611c45a1
parent9778537b6738d8693e887c3b0c8bc4d5a0aa28ce (diff)
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.
-rw-r--r--lib/libc/stdlib/div.314
-rw-r--r--lib/libc/stdlib/div.c6
-rw-r--r--lib/libc/stdlib/imaxdiv.36
-rw-r--r--lib/libc/stdlib/ldiv.314
-rw-r--r--lib/libc/stdlib/ldiv.c6
-rw-r--r--lib/libc/stdlib/lldiv.36
6 files changed, 28 insertions, 24 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 7b785ef66c16..4e92c56dd3e2 100644
--- a/lib/libc/stdlib/ldiv.c
+++ b/lib/libc/stdlib/ldiv.c
@@ -35,12 +35,12 @@
#include <stdlib.h> /* ldiv_t */
ldiv_t
-ldiv(long num, long denom)
+ldiv(long numer, long denom)
{
ldiv_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/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