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.
This commit is contained in:
@@ -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 ,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user