]> www.ginac.de Git - cln.git/blob - src/integer/division/cl_I_exquo.cc
* */*: Removed problematic stdin, stdout and stderr definitions.
[cln.git] / src / integer / division / cl_I_exquo.cc
1 // exquo().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/integer.h"
8
9
10 // Implementation.
11
12 #include "cl_I.h"
13
14 namespace cln {
15
16 const cl_I exquo (const cl_I& x, const cl_I& y)
17 {
18 // Methode:
19 // (exquo x y) :==
20 // (DIVIDE (abs x) (abs y)) -> q,r
21 // Falls r<>0, Error.
22 // Falls x,y verschiedene Vorzeichen haben, liefere -q, sonst q.
23   var cl_I_div_t q_r = cl_divide(abs(x),abs(y));
24   if (!zerop(q_r.remainder)) { cl_error_exquo(x,y); }
25   if (minusp(x) == minusp(y))
26     { return q_r.quotient; }
27     else
28     { return -q_r.quotient; }
29 }
30
31 }  // namespace cln