From 0703ea9ea4155d59d1356713789c60f5e6e8c7a6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 11 May 2016 18:22:11 +0200 Subject: Always satisfy n=qd+r to avoid confusion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- doc/arithmetic.tex | 3 ++- doc/refsheet.tex | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/arithmetic.tex b/doc/arithmetic.tex index 32a9947..9519ee0 100644 --- a/doc/arithmetic.tex +++ b/doc/arithmetic.tex @@ -4,7 +4,8 @@ In this chapter, we will learn how to perform basic arithmetic with libzahl: addition, subtraction, multiplication, division, modulus, exponentiation, -and sign manipulation. +and sign manipulation. \secref{sec:Division} is of +special importance. \vspace{1cm} \minitoc diff --git a/doc/refsheet.tex b/doc/refsheet.tex index 7680629..045b44c 100644 --- a/doc/refsheet.tex +++ b/doc/refsheet.tex @@ -47,18 +47,18 @@ Unless specified otherwise, returns are {\tt void} and all parameters are of typ \entry{zadd(a, b, c)} {$a \gets b + c$} {} \entry{zsub(a, b, c)} {$a \gets b - c$} {} \entry{zmul(a, b, c)} {$a \gets b \cdot c$} {} -\entry{zmodmul(a, b, c, d)} {$a \gets b \cdot c \mod d$} {$0 \le a < \ab{d}$} +\entry{zmodmul(a, b, c, d)} {$a \gets b \cdot c \mod d$} {$0 \le a~\mbox{sgn}~bc < \ab{d}$} \entry{zdiv(a, b, c)} {$a \gets b / c$} {rounded towards zero} \entry{zdivmod(a, b, c, d)} {$a \gets c / d$} {rounded towards zero} -\entry{zdivmod(a, b, c, d)} {$b \gets c \mod d$} {$0 \le b < \ab{d}$} -\entry{zmod(a, b, c)} {$a \gets b \mod c$} {$0 \le a < \ab{c}$} +\entry{zdivmod(a, b, c, d)} {$b \gets c \mod d$} {$0 \le b~\mbox{sgn}~c < \ab{d}$} +\entry{zmod(a, b, c)} {$a \gets b \mod c$} {$0 \le a~\mbox{sgn}~b < \ab{c}$} %\entry{zdiv\_exact(a, b, c)} {$a \gets b / c$} {assumes $c \vert d$} \entry{zsqr(a, b)} {$a \gets b^2$} {} \entry{zmodsqr(a, b, c)} {$a \gets b^2 \mod c$} {$0 \le a < \ab{c}$} \entry{zsqr(a, b)} {$a \gets b^2$} {} \entry{zpow(a, b, c)} {$a \gets b^c$} {} \entry{zpowu(a, b, c)} {$a \gets b^c$} {{\tt c} is an \ullong{}} -\entry{zmodpow(a, b, c, d)} {$a \gets b^c \mod d$} {$0 \le a < \ab{d}$} +\entry{zmodpow(a, b, c, d)} {$a \gets b^c \mod d$} {$0 \le a~\mbox{sgn}~b^c < \ab{d}$} \entry{zmodpowu(a, b, c, d)} {$a \gets b^c \mod d$} {ditto, {\tt c} is an \ullong{}} \entry{zabs(a, b)} {$a \gets \ab{b}$} {} \entry{zneg(a, b)} {$a \gets -b$} {} -- cgit v1.2.3-70-g09d2