Skip to content

Commit 0b9cb0f

Browse files
committed
[time.cal.month.nonmembers,time.cal.wd.nonmembers] Do not digress to Eucledian algorithm
1 parent e23cbb5 commit 0b9cb0f

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

source/time.tex

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4427,16 +4427,9 @@
44274427
\begin{itemdescr}
44284428
\pnum
44294429
\returns
4430-
\begin{codeblock}
4431-
month{modulo(static_cast<long long>(unsigned{x}) + (y.count() - 1), 12) + 1}
4432-
\end{codeblock}
4433-
where \tcode{modulo(n, 12)} computes the remainder of \tcode{n} divided by 12 using Euclidean division.
4434-
\begin{note}
4435-
Given a divisor of 12, Euclidean division truncates towards negative infinity and
4436-
always produces a remainder in the range of \crange{0}{11}.
4437-
Assuming no overflow in the signed summation,
4438-
this operation results in a \tcode{month} holding a value in the range \crange{1}{12} even if \tcode{!x.ok()}.
4439-
\end{note}
4430+
A \tcode{month} with \tcode{m_} equal to the sum of \tcode{unsigned\{x\}}
4431+
and \tcode{y.count()}, reduced modulo 12 to an integer in the range
4432+
\crange{1}{12}.
44404433
\begin{example}
44414434
\tcode{February + months\{11\} == January}.
44424435
\end{example}
@@ -5135,16 +5128,9 @@
51355128
\begin{itemdescr}
51365129
\pnum
51375130
\returns
5138-
\begin{codeblock}
5139-
weekday{modulo(static_cast<long long>(unsigned{x}) + y.count(), 7)}
5140-
\end{codeblock}
5141-
where \tcode{modulo(n, 7)} computes the remainder of \tcode{n} divided by 7 using Euclidean division.
5142-
\begin{note}
5143-
Given a divisor of 7, Euclidean division truncates towards negative infinity and
5144-
always produces a remainder in the range of \crange{0}{6}.
5145-
Assuming no overflow in the signed summation,
5146-
this operation results in a \tcode{weekday} holding a value in the range \crange{0}{6} even if \tcode{!x.ok()}.
5147-
\end{note}
5131+
A \tcode{weekday} with \tcode{wd_} equal to the sum of \tcode{unsigned\{x\}}
5132+
and \tcode{y.count()}, reduced modulo 7 to an integer in the range
5133+
\crange{0}{6}.
51485134
\begin{example}
51495135
\tcode{Monday + days\{6\} == Sunday}.
51505136
\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