Skip to content

Commit 2f3823a

Browse files
committed
[time.cal.month.nonmembers,time.cal.wd.nonmembers] Do not digress to Eucledian algorithm.
1 parent 61b6c21 commit 2f3823a

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

source/utilities.tex

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21856,16 +21856,9 @@
2185621856
\begin{itemdescr}
2185721857
\pnum
2185821858
\returns
21859-
\begin{codeblock}
21860-
month{modulo(static_cast<long long>(unsigned{x}) + (y.count() - 1), 12) + 1}
21861-
\end{codeblock}
21862-
where \tcode{modulo(n, 12)} computes the remainder of \tcode{n} divided by 12 using Euclidean division.
21863-
\begin{note}
21864-
Given a divisor of 12, Euclidean division truncates towards negative infinity and
21865-
always produces a remainder in the range of \crange{0}{11}.
21866-
Assuming no overflow in the signed summation,
21867-
this operation results in a \tcode{month} holding a value in the range \crange{1}{12} even if \tcode{!x.ok()}.
21868-
\end{note}
21859+
A \tcode{month} with \tcode{m_} equal to the sum of \tcode{unsigned\{x\}}
21860+
and \tcode{y.count()}, reduced modulo 12 to an integer in the range
21861+
\crange{1}{12}.
2186921862
\begin{example}
2187021863
\tcode{February + months\{11\} == January}.
2187121864
\end{example}
@@ -22564,16 +22557,9 @@
2256422557
\begin{itemdescr}
2256522558
\pnum
2256622559
\returns
22567-
\begin{codeblock}
22568-
weekday{modulo(static_cast<long long>(unsigned{x}) + y.count(), 7)}
22569-
\end{codeblock}
22570-
where \tcode{modulo(n, 7)} computes the remainder of \tcode{n} divided by 7 using Euclidean division.
22571-
\begin{note}
22572-
Given a divisor of 7, Euclidean division truncates towards negative infinity and
22573-
always produces a remainder in the range of \crange{0}{6}.
22574-
Assuming no overflow in the signed summation,
22575-
this operation results in a \tcode{weekday} holding a value in the range \crange{0}{6} even if \tcode{!x.ok()}.
22576-
\end{note}
22560+
A \tcode{weekday} with \tcode{wd_} equal to the sum of \tcode{unsigned\{x\}}
22561+
and \tcode{y.count()}, reduced modulo 7 to an integer in the range
22562+
\crange{0}{6}.
2257722563
\begin{example}
2257822564
\tcode{Monday + days\{6\} == Sunday}.
2257922565
\end{example}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy