Skip to content

[rand.eng], [rand.adapt] Use maths to describe relations between constants #4295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
69 changes: 33 additions & 36 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2540,6 +2540,13 @@
and for equality and inequality operators
are not shown in the synopses.

\pnum
In the descriptions of the random number engines
and random number engine adaptors
in \ref{rand.eng} and in \ref{rand.adapt},
a constant such as $c$ takes the value of the non-type template parameter
of the same name, \tcode{c}, unless otherwise specified.

\pnum
Each template specified in \ref{rand.eng}
requires one or more relationships,
Expand Down Expand Up @@ -2648,12 +2655,10 @@
\end{note}

\pnum
If the template parameter
\tcode{m} is not $0$,
the following relations shall hold:
\tcode{a < m}
The following relations shall hold:
$a < m$
and
\tcode{c < m}.
$c < m$.

\pnum
The textual representation
Expand All @@ -2668,9 +2673,9 @@
\begin{itemdescr}
\pnum
\effects
If $c \bmod m$ is $0$ and $\tcode{s} \bmod m$ is $0$,
If $c \bmod m$ is $0$ and $s \bmod m$ is $0$,
sets the engine's state to $1$,
otherwise sets the engine's state to $\tcode{s} \bmod m$.
otherwise sets the engine's state to $s \bmod m$.
\end{itemdescr}

\indexlibraryctor{linear_congruential_engine}%
Expand Down Expand Up @@ -2818,21 +2823,19 @@

\pnum
The following relations shall hold:
\tcode{0 < m},
\tcode{m <= n},
\tcode{2u < w},
\tcode{r <= w},
\tcode{u <= w},
\tcode{s <= w},
\tcode{t <= w},
\tcode{l <= w},
\tcode{w <= numeric_limits<UIntType>::digits},
\tcode{a <= (1u<<w) - 1u},
\tcode{b <= (1u<<w) - 1u},
\tcode{c <= (1u<<w) - 1u},
\tcode{d <= (1u<<w) - 1u},
$0 < m \leq n$,
$2 < w \leq \tcode{numeric_limits<result_type>::digits}$,
$r \leq w$,
$u \leq w$,
$s \leq w$,
$t \leq w$,
$l \leq w$,
$a \leq 2^w - 1$,
$b \leq 2^w - 1$,
$c \leq 2^w - 1$,
$d \leq 2^w - 1$,
and
\tcode{f <= (1u<<w) - 1u}.
$f \leq 2^w - 1$.

\pnum
The textual representation
Expand Down Expand Up @@ -2984,11 +2987,9 @@

\pnum
The following relations shall hold:
\tcode{0u < s},
\tcode{s < r},
\tcode{0 < w},
$0 < s < r$
and
\tcode{w <= numeric_limits<UIntType>::digits}.
$0 < w \leq \tcode{numeric_limits<result_type>::digits}$.

\pnum
The textual representation
Expand Down Expand Up @@ -3026,7 +3027,7 @@

\pnum
\complexity
Exactly $n \cdot \tcode{r}$ invocations
Exactly $n \cdot r$ invocations
of \tcode{e}.
\end{itemdescr}

Expand Down Expand Up @@ -3196,10 +3197,8 @@
\end{codeblock}

\pnum
The following relations shall hold:
\tcode{0 < r}
and
\tcode{r <= p}.
The following relation shall hold:
$0 < r \leq p$.

\pnum
The textual representation
Expand Down Expand Up @@ -3342,10 +3341,8 @@
\end{codeblock}%

\pnum
The following relations shall hold:
\tcode{0 < w}
and
\tcode{w <= numeric_limits<result_type>::digits}.
The following relation shall hold:
$0 < w \leq \tcode{numeric_limits<result_type>::digits}$.

\pnum
The textual representation
Expand Down Expand Up @@ -3392,7 +3389,7 @@

\pnum
The generation algorithm
yields the last value of \tcode{Y}
yields the last value of $Y$
produced while advancing \tcode{e}'s state as described above.

\indexlibraryglobal{shuffle_order_engine}%
Expand Down Expand Up @@ -3448,7 +3445,7 @@

\pnum
The following relation shall hold:
\tcode{0 < k}.
$0 < k$.

\pnum
The textual representation
Expand Down