aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/bigrecy_32bit_upstream.patch
blob: c103141413962f1bc0b0d5cf2a4d55f3e86c3012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Description: Support ARM64 ("aarch64") platform
Author: Jakub Bogusz
--- a/scl.c	2015/01/03 20:50:15	1.142
+++ b/scl.c	2016/08/10 02:33:05	1.143
@@ -166,33 +166,34 @@
     /* try first with starved precision */
     {
       num = scm_ash(mant, MAKINUM(e2 - point));
-      bigrecy(mant);
+      if (num != mant) bigrecy(mant);
       quo = scm_round_quotient(num, VELTS(pows5)[(long) point]);
       if (pmantexp2dbl(quo, point) != f) {
-	bigrecy(quo); quo = num;
+	if (quo != num) { bigrecy(quo); quo = num; }
 	num = scm_ash(quo, MAKINUM(1L));
-	bigrecy(quo);
+	if (num != quo) bigrecy(quo);
 	quo = scm_round_quotient(num, VELTS(pows5)[(long) --point]);
       }
+      if (num != quo) bigrecy(num);
     }
   } else {   /* e2 <= 0 */
     /* try first with starved precision */
     {
       SCM den = scm_ash(MAKINUM(1L), MAKINUM(point - e2));
       num = product(mant, VELTS(pows5)[- (long) point]);
-      bigrecy(mant);
+      if (num != mant) { bigrecy(mant); if (mant != MAKINUM(1)) mant = INUM0; }
       quo = scm_round_quotient(num, den);
       if (pmantexp2dbl(quo, point) != f) {
-	bigrecy(quo); quo = num;
+	if (quo != num) { bigrecy(quo); quo = num; }
 	point--;
 	num = product(quo, MAKINUM(10));
 	if (mant != MAKINUM(1)) bigrecy(quo);
 	quo = scm_round_quotient(num, den);
-      }
+	if (quo != num) bigrecy(num);
+      } else if ((mant != MAKINUM(1)) && (quo != num)) bigrecy(num);
       bigrecy(den);
     }
   }
-  bigrecy(num);
   a[ch++] = '.';
   /* if (sizeof(UBIGLONG)>=sizeof(double)) /\* Is ulong larger than mantissa? *\/ */
   /*   ch += iulong2str(num2ulong(quo, (char *)ARG1, s_number2string), 10, &a[ch]); */
@@ -680,7 +681,7 @@
       ans = ldexp(ans, bex + point);
     }
     if (num != quo) bigrecy(quo);
-    if (bmant != MAKINUM(1L)) bigrecy(num);
+    if ((num != bmant) && (bmant != MAKINUM(1L))) bigrecy(num);
     return ans;
   } else {
     int maxpow = LENGTH(pows5) - 1;
@@ -696,7 +697,7 @@
       quo = scm_round_quotient(num, scm_ash(scl, MAKINUM(1L)));
     }
     if (-point > maxpow) bigrecy(scl);
-    bigrecy(num);
+    if (num != quo) bigrecy(num);
     ans = ldexp(int2dbl(quo), bex + point);
     bigrecy(quo);
     return ans;
@@ -2478,7 +2479,7 @@
 	tmp = acc;
 	acc = product(tmp, tz1);
 #ifdef BIGDIG
-	bigrecy(tmp);
+	if (acc != tmp) bigrecy(tmp);
 #endif
 	break;
       }
@@ -2486,7 +2487,7 @@
 	tmp = acc;
 	acc = product(tmp, tz1);
 #ifdef BIGDIG
-	bigrecy(tmp);
+	if (acc != tmp) bigrecy(tmp);
 #endif
       }
       tmp = tz1;
@@ -2841,8 +2842,8 @@
       bex += j * BITSPERDIG;
       if (bex > 0) ans = ldexp(ans, bex);
     }
+    if (quo != num) bigrecy(quo);
     if (num != b) bigrecy(num);
-    if (quo != b) bigrecy(quo);
     if (tc16_bigneg==TYP16(b)) return -ans;
     return ans;
   }