aboutsummaryrefslogtreecommitdiffstats
path: root/man/zmod.3
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-05 16:36:56 +0100
committerMattias Andrée <maandree@kth.se>2016-03-05 16:37:07 +0100
commit8237156ffb390b38c55863d1b14f246af8a1c19c (patch)
treefc631b36bbcbb14b21b4a6e56cdfe8ca595f3e3b /man/zmod.3
parentMakefile: add check rule (diff)
downloadlibzahl-8237156ffb390b38c55863d1b14f246af8a1c19c.tar.gz
libzahl-8237156ffb390b38c55863d1b14f246af8a1c19c.tar.bz2
libzahl-8237156ffb390b38c55863d1b14f246af8a1c19c.tar.xz
More detailed description of division and modulus
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man/zmod.3')
-rw-r--r--man/zmod.313
1 files changed, 12 insertions, 1 deletions
diff --git a/man/zmod.3 b/man/zmod.3
index 9c6e72b..a6cd21d 100644
--- a/man/zmod.3
+++ b/man/zmod.3
@@ -24,11 +24,22 @@ Mod
.P
The result
.RI ( remainder )
-is always non-negative.
+is always non-negative. To be more precise,
+a Mod b = |a| Mod |b| for all integers a
+and b.
.P
It is safe to call
.B zmod
with non-unique parameters.
+.SH RATIONALE
+There are many ways to define modulus with
+negative integers. You have to select how the
+signness is selected, and when to invert
+(in respect to modulated addition) the remainder.
+The simplest way to implement modulus is to
+ignore the sign of the operands. This solution
+also makes it very easy for those that which
+to write a wrapper that changes the definition.
.SH SEE ALSO
.BR zdivmod (3),
.BR zstr (3),