libzahl

big integer library
git clone git://git.suckless.org/libzahl
Log | Files | Refs | README | LICENSE

zdivmod.3 (1046B)


      1 .TH ZDIVMOD 3 libzahl
      2 .SH NAME
      3 zdivmod - Calculate the quotient and the remainder of two big integer
      4 .SH SYNOPSIS
      5 .nf
      6 #include <zahl.h>
      7 
      8 void zdivmod(z_t \fIquotient\fP, z_t \fIremainder\fP, z_t \fIdividend\fP, z_t \fIdivisor\fP);
      9 .fi
     10 .SH DESCRIPTION
     11 .B zdivmod
     12 calculates the truncated quotient and the remainder of a
     13 .I dividend
     14 and a
     15 .IR divisor ,
     16 and stores the truncated quotient in
     17 .I quotient
     18 and the remainder in
     19 .IR remainder .
     20 That is,
     21 .I quotient
     22 gets
     23 .I dividend
     24 /
     25 .I divisor
     26 and
     27 .I remainder
     28 gets
     29 .I dividend
     30 Mod
     31 .IR divisor .
     32 .P
     33 It is safe to call
     34 .B zdivmod
     35 with non-unique parameters,
     36 except it is
     37 .I not
     38 safe to call
     39 .B zdivmod with
     40 .IR "(quotient==remainder)" .
     41 .P
     42 See
     43 .BR zmod (3)
     44 for details on modulation.
     45 .SH RATIONALE
     46 Calculating the remainder requires calculating division to
     47 be performed, and performing a division gives the remainder
     48 for free. It is often useful to calculate both.
     49 .SH SEE ALSO
     50 .BR zstr (3),
     51 .BR zadd (3),
     52 .BR zsub (3),
     53 .BR zmul (3),
     54 .BR zdiv (3),
     55 .BR zmod (3),
     56 .BR zneg (3),
     57 .BR zabs (3),
     58 .BR zpow (3)