Skip to content

Commit

Permalink
Add the new lib2 functions to the manual
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin D. Howard <gavin@gavinhoward.com>
  • Loading branch information
gavinhoward committed Sep 29, 2023
1 parent bd768da commit 4e70852
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 39 deletions.
22 changes: 19 additions & 3 deletions manuals/bc.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,14 @@ The extended library is a **non-portable extension**.

: Returns the factorial of the truncated absolute value of **x**.

**max(a, b)**

: Returns **a** if **a** is greater than **b**; otherwise, returns **b**.

**min(a, b)**

: Returns **a** if **a** is less than **b**; otherwise, returns **b**.

**perm(n, k)**

: Returns the permutation of the truncated absolute value of **n** of the
Expand Down Expand Up @@ -1512,20 +1520,28 @@ The extended library is a **non-portable extension**.

**frand(p)**

: Generates a pseudo-random number between **0** (inclusive) and **1**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
then **0** is returned, and **seed** is *not* changed.

**ifrand(i, p)**

: Generates a pseudo-random number that is between **0** (inclusive) and the
: Generates a pseudo-random integer that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and
**p** is not **0**, then calling this function will change the value of
**seed**; otherwise, **0** is returned and **seed** is not changed.
**seed**; otherwise, **0** is returned, and **seed** is not changed.

**i2rand(a, b)**

: Takes the truncated value of **a** and **b** and uses them as inclusive
bounds to enerate a pseudo-random integer. If the difference of the
truncated values of **a** and **b** is **0**, then the truncated value is
returned, and **seed** is *not* changed. Otherwise, this function will
change the value of **seed**.

**srand(x)**

Expand Down
28 changes: 22 additions & 6 deletions manuals/bc/A.1
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,14 @@ the rounding mode round away from \f[B]0\f[R]
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
.TP
\f[B]max(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is greater than \f[B]b\f[R];
otherwise, returns \f[B]b\f[R].
.TP
\f[B]min(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is less than \f[B]b\f[R]; otherwise,
returns \f[B]b\f[R].
.TP
\f[B]perm(n, k)\f[R]
Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
Expand Down Expand Up @@ -1762,7 +1770,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
Generates a pseudo-random integer between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
Expand All @@ -1771,14 +1779,22 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
number of decimal digits after the decimal point equal to the truncated
absolute value of \f[B]p\f[R].
Generates a pseudo-random integer that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
is returned, and \f[B]seed\f[R] is not changed.
.TP
\f[B]i2rand(a, b)\f[R]
Takes the truncated value of \f[B]a\f[R] and \f[B]b\f[R] and uses them
as inclusive bounds to enerate a pseudo-random integer.
If the difference of the truncated values of \f[B]a\f[R] and \f[B]b\f[R]
is \f[B]0\f[R], then the truncated value is returned, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
Otherwise, this function will change the value of \f[B]seed\f[R].
.TP
\f[B]srand(x)\f[R]
Returns \f[B]x\f[R] with its sign flipped with probability
Expand Down
22 changes: 19 additions & 3 deletions manuals/bc/A.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,14 @@ The extended library is a **non-portable extension**.

: Returns the factorial of the truncated absolute value of **x**.

**max(a, b)**

: Returns **a** if **a** is greater than **b**; otherwise, returns **b**.

**min(a, b)**

: Returns **a** if **a** is less than **b**; otherwise, returns **b**.

**perm(n, k)**

: Returns the permutation of the truncated absolute value of **n** of the
Expand Down Expand Up @@ -1422,20 +1430,28 @@ The extended library is a **non-portable extension**.

**frand(p)**

: Generates a pseudo-random number between **0** (inclusive) and **1**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
then **0** is returned, and **seed** is *not* changed.

**ifrand(i, p)**

: Generates a pseudo-random number that is between **0** (inclusive) and the
: Generates a pseudo-random integer that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and
**p** is not **0**, then calling this function will change the value of
**seed**; otherwise, **0** is returned and **seed** is not changed.
**seed**; otherwise, **0** is returned, and **seed** is not changed.

**i2rand(a, b)**

: Takes the truncated value of **a** and **b** and uses them as inclusive
bounds to enerate a pseudo-random integer. If the difference of the
truncated values of **a** and **b** is **0**, then the truncated value is
returned, and **seed** is *not* changed. Otherwise, this function will
change the value of **seed**.

**srand(x)**

Expand Down
28 changes: 22 additions & 6 deletions manuals/bc/H.1
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,14 @@ the rounding mode round away from \f[B]0\f[R]
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
.TP
\f[B]max(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is greater than \f[B]b\f[R];
otherwise, returns \f[B]b\f[R].
.TP
\f[B]min(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is less than \f[B]b\f[R]; otherwise,
returns \f[B]b\f[R].
.TP
\f[B]perm(n, k)\f[R]
Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
Expand Down Expand Up @@ -1762,7 +1770,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
Generates a pseudo-random integer between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
Expand All @@ -1771,14 +1779,22 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
number of decimal digits after the decimal point equal to the truncated
absolute value of \f[B]p\f[R].
Generates a pseudo-random integer that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
is returned, and \f[B]seed\f[R] is not changed.
.TP
\f[B]i2rand(a, b)\f[R]
Takes the truncated value of \f[B]a\f[R] and \f[B]b\f[R] and uses them
as inclusive bounds to enerate a pseudo-random integer.
If the difference of the truncated values of \f[B]a\f[R] and \f[B]b\f[R]
is \f[B]0\f[R], then the truncated value is returned, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
Otherwise, this function will change the value of \f[B]seed\f[R].
.TP
\f[B]srand(x)\f[R]
Returns \f[B]x\f[R] with its sign flipped with probability
Expand Down
22 changes: 19 additions & 3 deletions manuals/bc/H.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,14 @@ The extended library is a **non-portable extension**.

: Returns the factorial of the truncated absolute value of **x**.

**max(a, b)**

: Returns **a** if **a** is greater than **b**; otherwise, returns **b**.

**min(a, b)**

: Returns **a** if **a** is less than **b**; otherwise, returns **b**.

**perm(n, k)**

: Returns the permutation of the truncated absolute value of **n** of the
Expand Down Expand Up @@ -1422,20 +1430,28 @@ The extended library is a **non-portable extension**.

**frand(p)**

: Generates a pseudo-random number between **0** (inclusive) and **1**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
then **0** is returned, and **seed** is *not* changed.

**ifrand(i, p)**

: Generates a pseudo-random number that is between **0** (inclusive) and the
: Generates a pseudo-random integer that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and
**p** is not **0**, then calling this function will change the value of
**seed**; otherwise, **0** is returned and **seed** is not changed.
**seed**; otherwise, **0** is returned, and **seed** is not changed.

**i2rand(a, b)**

: Takes the truncated value of **a** and **b** and uses them as inclusive
bounds to enerate a pseudo-random integer. If the difference of the
truncated values of **a** and **b** is **0**, then the truncated value is
returned, and **seed** is *not* changed. Otherwise, this function will
change the value of **seed**.

**srand(x)**

Expand Down
28 changes: 22 additions & 6 deletions manuals/bc/HN.1
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,14 @@ the rounding mode round away from \f[B]0\f[R]
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
.TP
\f[B]max(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is greater than \f[B]b\f[R];
otherwise, returns \f[B]b\f[R].
.TP
\f[B]min(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is less than \f[B]b\f[R]; otherwise,
returns \f[B]b\f[R].
.TP
\f[B]perm(n, k)\f[R]
Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
Expand Down Expand Up @@ -1762,7 +1770,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
Generates a pseudo-random integer between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
Expand All @@ -1771,14 +1779,22 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
number of decimal digits after the decimal point equal to the truncated
absolute value of \f[B]p\f[R].
Generates a pseudo-random integer that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
is returned, and \f[B]seed\f[R] is not changed.
.TP
\f[B]i2rand(a, b)\f[R]
Takes the truncated value of \f[B]a\f[R] and \f[B]b\f[R] and uses them
as inclusive bounds to enerate a pseudo-random integer.
If the difference of the truncated values of \f[B]a\f[R] and \f[B]b\f[R]
is \f[B]0\f[R], then the truncated value is returned, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
Otherwise, this function will change the value of \f[B]seed\f[R].
.TP
\f[B]srand(x)\f[R]
Returns \f[B]x\f[R] with its sign flipped with probability
Expand Down
22 changes: 19 additions & 3 deletions manuals/bc/HN.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,14 @@ The extended library is a **non-portable extension**.

: Returns the factorial of the truncated absolute value of **x**.

**max(a, b)**

: Returns **a** if **a** is greater than **b**; otherwise, returns **b**.

**min(a, b)**

: Returns **a** if **a** is less than **b**; otherwise, returns **b**.

**perm(n, k)**

: Returns the permutation of the truncated absolute value of **n** of the
Expand Down Expand Up @@ -1422,20 +1430,28 @@ The extended library is a **non-portable extension**.

**frand(p)**

: Generates a pseudo-random number between **0** (inclusive) and **1**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
then **0** is returned, and **seed** is *not* changed.

**ifrand(i, p)**

: Generates a pseudo-random number that is between **0** (inclusive) and the
: Generates a pseudo-random integer that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and
**p** is not **0**, then calling this function will change the value of
**seed**; otherwise, **0** is returned and **seed** is not changed.
**seed**; otherwise, **0** is returned, and **seed** is not changed.

**i2rand(a, b)**

: Takes the truncated value of **a** and **b** and uses them as inclusive
bounds to enerate a pseudo-random integer. If the difference of the
truncated values of **a** and **b** is **0**, then the truncated value is
returned, and **seed** is *not* changed. Otherwise, this function will
change the value of **seed**.

**srand(x)**

Expand Down
28 changes: 22 additions & 6 deletions manuals/bc/N.1
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,14 @@ the rounding mode round away from \f[B]0\f[R]
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
.TP
\f[B]max(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is greater than \f[B]b\f[R];
otherwise, returns \f[B]b\f[R].
.TP
\f[B]min(a, b)\f[R]
Returns \f[B]a\f[R] if \f[B]a\f[R] is less than \f[B]b\f[R]; otherwise,
returns \f[B]b\f[R].
.TP
\f[B]perm(n, k)\f[R]
Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
Expand Down Expand Up @@ -1762,7 +1770,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
Generates a pseudo-random integer between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
Expand All @@ -1771,14 +1779,22 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
number of decimal digits after the decimal point equal to the truncated
absolute value of \f[B]p\f[R].
Generates a pseudo-random integer that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
is returned, and \f[B]seed\f[R] is not changed.
.TP
\f[B]i2rand(a, b)\f[R]
Takes the truncated value of \f[B]a\f[R] and \f[B]b\f[R] and uses them
as inclusive bounds to enerate a pseudo-random integer.
If the difference of the truncated values of \f[B]a\f[R] and \f[B]b\f[R]
is \f[B]0\f[R], then the truncated value is returned, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
Otherwise, this function will change the value of \f[B]seed\f[R].
.TP
\f[B]srand(x)\f[R]
Returns \f[B]x\f[R] with its sign flipped with probability
Expand Down
Loading

0 comments on commit 4e70852

Please sign in to comment.