diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-05 16:36:56 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-05 16:37:07 +0100 |
| commit | 8237156ffb390b38c55863d1b14f246af8a1c19c (patch) | |
| tree | fc631b36bbcbb14b21b4a6e56cdfe8ca595f3e3b | |
| parent | Makefile: add check rule (diff) | |
| download | libzahl-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 '')
| -rw-r--r-- | man/zdiv.3 | 2 | ||||
| -rw-r--r-- | man/zdivmod.3 | 8 | ||||
| -rw-r--r-- | man/zmod.3 | 13 | ||||
| -rw-r--r-- | man/zmodmul.3 | 4 | ||||
| -rw-r--r-- | man/zmodpow.3 | 4 | ||||
| -rw-r--r-- | man/zmodpowu.3 | 4 | ||||
| -rw-r--r-- | man/zmodsqr.3 | 4 |
7 files changed, 35 insertions, 4 deletions
@@ -9,7 +9,7 @@ void zdiv(z_t \fIquotient\fP, z_t \fIdividend\fP, z_t \fIdivisor\fP); .fi .SH DESCRIPTION .B zdiv -calculates the quotient of a +calculates the truncated quotient of a .I dividend and a .IR divisor , diff --git a/man/zdivmod.3 b/man/zdivmod.3 index b11b8b6..f0cd9e4 100644 --- a/man/zdivmod.3 +++ b/man/zdivmod.3 @@ -9,11 +9,11 @@ void zdivmod(z_t \fIquotient\fP, z_t \fIremainder\fP, z_t \fIdividend\fP, z_t \f .fi .SH DESCRIPTION .B zdivmod -calculates the quotient and the remainder of a +calculates the truncated quotient and the remainder of a .I dividend and a .IR divisor , -and stores the quotient in +and stores the truncated quotient in .I quotient and the remainder in .IR remainder . @@ -38,6 +38,10 @@ except it is safe to call .B zdivmod with .IR "(quotient==remainder)" . +.P +See +.BR zmod (3) +for details on modulation. .SH RATIONALE Calculating the remainder requires calculating division to be performed, and performing a division gives the remainder @@ -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), diff --git a/man/zmodmul.3 b/man/zmodmul.3 index cbee629..3ce7247 100644 --- a/man/zmodmul.3 +++ b/man/zmodmul.3 @@ -29,6 +29,10 @@ Mod It is safe to call .B zmodmul with non-unique parameters. +.P +See +.BR zmod (3) +for details on modulation. .SH RATIONALE It is possible to calculate the modular product with a faster algorithm than calculating the diff --git a/man/zmodpow.3 b/man/zmodpow.3 index 9a98985..0031617 100644 --- a/man/zmodpow.3 +++ b/man/zmodpow.3 @@ -29,6 +29,10 @@ Mod It is safe to call .B zmodpow with non-unique parameters. +.P +See +.BR zmod (3) +for details on modulation. .SH RATIONALE It is possible to calculate the modular power with a faster algorithm than calculating the diff --git a/man/zmodpowu.3 b/man/zmodpowu.3 index 09ea9b3..2a04a16 100644 --- a/man/zmodpowu.3 +++ b/man/zmodpowu.3 @@ -29,6 +29,10 @@ Mod It is safe to call .B zmodpowu with non-unique parameters. +.P +See +.BR zmod (3) +for details on modulation. .SH RATIONALE It is possible to calculate the modular power with a faster algorithm than calculating the diff --git a/man/zmodsqr.3 b/man/zmodsqr.3 index c54cc01..ba33aab 100644 --- a/man/zmodsqr.3 +++ b/man/zmodsqr.3 @@ -25,6 +25,10 @@ Mod It is safe to call .B zmodsqr with non-unique parameters. +.P +See +.BR zmod (3) +for details on modulation. .SH RATIONALE See rationle for .BR zmodmul (3), |
