From b34e60895e57345b5c8804f1fd7ae36606a42ff6 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Mon, 26 Nov 2018 12:55:58 +0100 Subject: [PATCH] [time.cal.month.nonmembers,time.cal.wd.nonmembers] Do not digress to Eucledian algorithm --- source/time.tex | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/source/time.tex b/source/time.tex index 506854d055..a05309c3af 100644 --- a/source/time.tex +++ b/source/time.tex @@ -4401,16 +4401,9 @@ \begin{itemdescr} \pnum \returns -\begin{codeblock} -month{modulo(static_cast(unsigned{x}) + (y.count() - 1), 12) + 1} -\end{codeblock} -where \tcode{modulo(n, 12)} computes the remainder of \tcode{n} divided by 12 using Euclidean division. -\begin{note} -Given a divisor of 12, Euclidean division truncates towards negative infinity and -always produces a remainder in the range of \crange{0}{11}. -Assuming no overflow in the signed summation, -this operation results in a \tcode{month} holding a value in the range \crange{1}{12} even if \tcode{!x.ok()}. -\end{note} +A \tcode{month} with \tcode{m_} equal to the sum of \tcode{unsigned\{x\}} +and \tcode{y.count()}, reduced modulo 12 to an integer in the range +\crange{1}{12}. \begin{example} \tcode{February + months\{11\} == January}. \end{example} @@ -5128,16 +5121,9 @@ \begin{itemdescr} \pnum \returns -\begin{codeblock} -weekday{modulo(static_cast(x.wd_) + y.count(), 7)} -\end{codeblock} -where \tcode{modulo(n, 7)} computes the remainder of \tcode{n} divided by 7 using Euclidean division. -\begin{note} -Given a divisor of 7, Euclidean division truncates towards negative infinity and -always produces a remainder in the range of \crange{0}{6}. -Assuming no overflow in the signed summation, -this operation results in a \tcode{weekday} holding a value in the range \crange{0}{6} even if \tcode{!x.ok()}. -\end{note} +A \tcode{weekday} with \tcode{wd_} equal to the sum of \tcode{x.wd_} +and \tcode{y.count()}, reduced modulo 7 to an integer in the range +\crange{0}{6}. \begin{example} \tcode{Monday + days\{6\} == Sunday}. \end{example} 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