Skip to content

Commit 2ab2ab6

Browse files
docs: add text document
1 parent c842d3f commit 2ab2ab6

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

docs/protocols/divide_modulo.tex

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
\documentclass[11pt]{article}
2+
\usepackage[T1]{fontenc}
3+
\usepackage[utf8]{inputenc}
4+
\usepackage{lmodern}
5+
\usepackage[margin=1in]{geometry}
6+
\usepackage{graphicx}
7+
\usepackage{amsmath,amssymb}
8+
\usepackage{booktabs}
9+
\usepackage{hyperref}
10+
\usepackage{microtype}
11+
\usepackage{todonotes}
12+
\DeclareMathOperator{\nonneg}{nonneg}
13+
\hypersetup{
14+
colorlinks=true,
15+
linkcolor=blue,
16+
citecolor=blue,
17+
urlcolor=blue
18+
}
19+
\setlength{\parindent}{0pt}
20+
\setlength{\parskip}{6pt}
21+
22+
\title{Divide and Modulo}
23+
\author{Space and Time Inc}
24+
\date{March 2025}
25+
26+
\begin{document}
27+
\maketitle
28+
29+
\noindent Let $A=(a_{i})$ and $B=(b_{i})$ be columns of signed integers. We need to prove that $Q=(q'_{i})$ is the quotient of $N$ and $D$ and $R=(r_{i})$ is the remainder of $N$ and $D$. \\
30+
There are a couple abnormalities to our definitions of quotient and remainder:
31+
\begin{itemize}
32+
\item For division by 0, the quotient is defined as 0, and the remainder is defined to be the numerator.
33+
\item If the numerator is the minimum value for the unsigned int type and the denominator is $-1$, the quotient is defined to be the minimum value for the unsigned int type and the remainder is $0$.
34+
\item The remainder is not necessarily positive. It will match the sign of the numerator, unless the remainder is $0$.
35+
\end{itemize}
36+
37+
\section{Summary}
38+
\begin{itemize}
39+
\item Plan values: None
40+
\item Inputs: $N$, $D$
41+
\item Outputs: $Q$, $R$
42+
\item Hints: $s$, $t$, $u$, $v$.
43+
\end{itemize}
44+
45+
\section{Details}
46+
47+
The $6$ constraints are:
48+
49+
\begin{align*}
50+
q\cdot b + r &\equiv a\tag{1}\\
51+
r\cdot \nonneg(r)&\equiv r\cdot \nonneg(a)\tag{2}\\
52+
\nonneg(r-b)\cdot b + \nonneg(r+b)\cdot b &\equiv b \tag{3.1}\\
53+
(r-b)\cdot (r+b)\cdot t + b&\equiv 0\tag{3.2}\\
54+
(s-q)(s-b)&\equiv 0\tag{4.1}\\
55+
[-\sqrt{-MIN},-\sqrt{MIN}]&\supset s\tag{4.2}\\
56+
[-MIN,MAX]&\supset q'\tag{4.3}\\
57+
b \cdot u &= q\\
58+
(q'-q)\cdot (q+MIN)&\equiv 0\tag{6.1}\\
59+
(q+MIN)\cdot v-(q'-MIN)&\equiv 0\tag{6.2}\\
60+
\end{align*}
61+
\end{document}

0 commit comments

Comments
 (0)