aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/bc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 6dc79118a..073a113fb 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -1840,12 +1840,19 @@ static BcStatus bc_num_d(BcNum *a, BcNum *b, BcNum *restrict c, size_t scale)
1840 for (q = 0; (!s && n[len] != 0) || bc_num_compare(n, p, len) >= 0; ++q) 1840 for (q = 0; (!s && n[len] != 0) || bc_num_compare(n, p, len) >= 0; ++q)
1841 bc_num_subArrays(n, p, len); 1841 bc_num_subArrays(n, p, len);
1842 c->num[i] = q; 1842 c->num[i] = q;
1843 // a=2^100000
1844 // scale=40000
1845 // 1/a <- without check below, this will not be interruptible
1846 if (G_interrupt) {
1847 s = BC_STATUS_FAILURE;
1848 break;
1849 }
1843 } 1850 }
1844 1851
1845 bc_num_retireMul(c, scale, a->neg, b->neg); 1852 bc_num_retireMul(c, scale, a->neg, b->neg);
1846 bc_num_free(&cp); 1853 bc_num_free(&cp);
1847 1854
1848 return BC_STATUS_SUCCESS; // can't make void, see bc_num_binary() 1855 return s;
1849} 1856}
1850 1857
1851static BcStatus bc_num_r(BcNum *a, BcNum *b, BcNum *restrict c, 1858static BcStatus bc_num_r(BcNum *a, BcNum *b, BcNum *restrict c,
@@ -1864,7 +1871,8 @@ static BcStatus bc_num_r(BcNum *a, BcNum *b, BcNum *restrict c,
1864 } 1871 }
1865 1872
1866 bc_num_init(&temp, d->cap); 1873 bc_num_init(&temp, d->cap);
1867 bc_num_d(a, b, c, scale); 1874 s = bc_num_d(a, b, c, scale);
1875 if (s) goto err;
1868 1876
1869 if (scale != 0) scale = ts; 1877 if (scale != 0) scale = ts;
1870 1878