big2.c
Go to the documentation of this file.
1 pointer
3 pointer x, y;
4 int i;
5 { pointer q, qq;
6  int xsize, ysize, *xv, *yv, j, k;
7  xsize=bigsize(x); ysize=bigsize(y);
8 
9  if (i < 0) return(NULL);
10  if (i == 0) {
11  i = div_big_big(y, x);
12  if (i == 0) return(NULL);
13  else {
14  qq = makebig(1);
15  bigvec(qq)[0] = i;
16  return(qq);
17  }
18  }
19 
20  qq=makebig(i);
21 
22  for (k=i-1; k>=0; i--) {
23  j=div_big_big
24 
25  q = big_quotient_remainder_auxiliary(x->big_cdr, y, i-1);
26  i = div_big_big(y, x);
27  vpush(((object)q));
28  qq = (struct bignum *)alloc_object(t_bignum);
29 
30  qq->big_car = i;
31  qq->big_cdr = q;
32  return(qq);}
33 
34 /*
35  Big_quotient_remainder(x0, y0, qp, rp)
36  sets the quotient and the remainder of the division of x0 by y0
37  to *qp and *rp respectively.
38  X0 should be a positive bignum.
39  Y0 should be a non-negative bignum.
40 */
41 big_quotient_remainder(x0, y0, qp, rp)
42 pointer x0, y0, *qp, *rp;
43 {
45  pointer x, y;
46  int i, l, m;
47 
48  x = copy_big(x0);
49  vpush(x);
50  y = y0;
52  mul_int_big(i, x);
53  mul_int_big(i, y);
54  l = bigxize(x);
55  m = bigsize(y);
56  *qp = big_quotient_remainder_auxiliary(x, y, l - m);
57  if (*qp == NULL) {
58  *qp = makebig(1);
59  (*qp)->c.bgnm.bv->c.ivec.iv[0] = 0;
60  }
61  div_int_big(i, x);
62  div_int_big(i, y);
63  vpop();
64  *rp = x;
65 }
context * euscontexts[MAXTHREAD]
Definition: eus.c:105
eusinteger_t div_int_big(eusinteger_t c, pointer x)
Definition: big.c:627
Definition: eus.h:522
eusinteger_t get_standardizing_factor_and_normalize(pointer x)
Definition: big.c:782
Definition: eus.h:374
void mul_int_big(eusinteger_t c, pointer x)
Definition: big.c:606
long l
Definition: structsize.c:3
eusinteger_t div_big_big(pointer x, pointer y)
Definition: big.c:808
Definition: eus.h:379
pointer big_quotient_remainder_auxiliary(pointer x, pointer y, int i)
Definition: big2.c:2
pointer makebig()
#define NULL
Definition: transargv.c:8
unsigned int thr_self()
Definition: eus.c:25
pointer copy_big()
void big_quotient_remainder(pointer x0, pointer y0, pointer *qp, pointer *rp)
Definition: big.c:885


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 6 2019 20:00:43