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 }
l
long l
Definition: structsize.c:3
context
Definition: eus.h:524
div_int_big
eusinteger_t div_int_big(eusinteger_t c, pointer x)
Definition: big.c:628
big_quotient_remainder_auxiliary
pointer big_quotient_remainder_auxiliary(pointer x, pointer y, int i)
Definition: big2.c:2
div_big_big
eusinteger_t div_big_big(pointer x, pointer y)
Definition: big.c:809
NULL
#define NULL
Definition: transargv.c:8
mul_int_big
void mul_int_big(eusinteger_t c, pointer x)
Definition: big.c:607
big_quotient_remainder
void big_quotient_remainder(pointer x0, pointer y0, pointer *qp, pointer *rp)
Definition: big.c:886
euscontexts
context * euscontexts[MAXTHREAD]
Definition: eus.c:105
cell
Definition: eus.h:381
makebig
pointer makebig()
copy_big
pointer copy_big()
get_standardizing_factor_and_normalize
eusinteger_t get_standardizing_factor_and_normalize(pointer x)
Definition: big.c:783
bignum
Definition: eus.h:376
thr_self
unsigned int thr_self()
Definition: eus.c:25


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:42