1
/* Copyright William F. Schelter 1991
6
num_arith.c: add_int_big
9
num_arith.c: big_quotient_remainder
11
num_arith.c: big_times
12
num_arith.c: complement_big
14
num_arith.c: div_int_big
15
num_arith.c: mul_int_big
16
num_arith.c: normalize_big
17
num_arith.c: normalize_big_to_object
18
num_arith.c: stretch_big
19
num_arith.c: sub_int_big
20
num_comp.c: big_compare
23
num_log.c: copy_to_big
24
num_log.c: normalize_big
25
num_log.c: normalize_big_to_object
26
num_log.c: stretch_big
28
number.c: big_to_double
29
predicate.c: big_compare
38
read.d: complement_big
41
read.d: normalize_big_to_object
45
#define remainder gclremainder
49
static char* (*gcl_gmp_allocfun)() = alloc_contblock;
51
DEFUN("SET-GMP-ALLOCATE-RELOCATABLE",object,fSset_gmp_allocate_relocatable,SI,1,1,NONE,OO,OO,OO,OO,
52
"Set the allocation to be relocatble ")(flag)
56
gcl_gmp_allocfun = alloc_relblock;
58
gcl_gmp_allocfun = alloc_contblock;
77
void set_big_sign(x,sign)
91
#ifndef HAVE_MP_COERCE_TO_STRING
93
double digitsPerBit[37]={ 0,0,
95
0.6309297535714574, /* 3 */
97
0.4306765580733931, /* 5 */
98
0.3868528072345416, /* 6 */
99
0.3562071871080222, /* 7 */
100
0.3333333333333334, /* 8 */
101
0.3154648767857287, /* 9 */
102
0.3010299956639811, /* 10 */
103
0.2890648263178878, /* 11 */
104
0.2789429456511298, /* 12 */
105
0.2702381544273197, /* 13 */
106
0.2626495350371936, /* 14 */
107
0.2559580248098155, /* 15 */
109
0.244650542118226, /* 17 */
110
0.2398124665681315, /* 18 */
111
0.2354089133666382, /* 19 */
112
0.2313782131597592, /* 20 */
113
0.227670248696953, /* 21 */
114
0.2242438242175754, /* 22 */
115
0.2210647294575037, /* 23 */
116
0.2181042919855316, /* 24 */
117
0.2153382790366965, /* 25 */
118
0.2127460535533632, /* 26 */
119
0.2103099178571525, /* 27 */
120
0.2080145976765095, /* 28 */
121
0.2058468324604345, /* 29 */
122
0.2037950470905062, /* 30 */
123
0.2018490865820999, /* 31 */
125
0.1982398631705605, /* 33 */
126
0.1965616322328226, /* 34 */
127
0.1949590218937863, /* 35 */
128
0.1934264036172708, /* 36 */
132
coerce_big_to_string(x,printbase)
136
int sign=big_sign(x);
138
int size = (int)((ceil(MP_SIZE_IN_BASE2(MP(x))* digitsPerBit[printbase]))+.01);
139
char *q,*p = alloca(size+5);
147
while (!big_zerop(b))
148
*q++=digit_weight(div_int_big(printbase, b),printbase);
150
object ans = alloc_simple_string(q-p);
151
ans->ust.ust_self=alloc_relblock(ans->ust.ust_dim);
152
bcopy(ans->ust.ust_self,p,ans->ust.ust_dim);
153
ans->ust.ust_fillp=ans->ust.ust_dim-1;