[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Scm-discuss] 5f2 regression: r4rstest.scm fails on 32-bit
From: |
Steve VanDevender |
Subject: |
[Scm-discuss] 5f2 regression: r4rstest.scm fails on 32-bit |
Date: |
Tue, 10 Oct 2017 20:07:47 -0700 |
Steve VanDevender writes:
> This has been bugging me for a while too. Here are some even more
> precise cases down to successive integers that, when converted to real
> numbers, print or do not (I also enabled one of the debugging printfs in
> pdbl2str):
>
> > (- (expt 2 49) 1)
> 562949953421311
> > 562949953421311.
> mantissa = 1 -> #x1ffffffffffff0; e2 = 49 -> -4; point = -1; ndig = 53 -> 53
> 5.62949953421311e14
> > (expt 2 49)
> 562949953421312
> > 562949953421312.
> mantissa = 0.5 -> #x10000000000000; e2 = 50 -> -3; point = 0; ndig = 53 -> 53
>
> ;ERROR: "/home/stevev/scm/Transcen.scm": round-quotient: Wrong type in arg1
> (0 . 0)
> ; in scope:
> ; (z1 z2) procedure expt
> ; defined by load: "/home/stevev/scm/Transcen.scm"
I've narrowed this down a bit further. When SCM attempts to print
562949953421312. it calls scm_round_quotient at line 182 of scl.c:
179 /* try first with starved precision */
180 {
181 SCM den = scm_ash(MAKINUM(1L), MAKINUM(point - e2));
182 num = product(mant, VELTS(pows5)[- (long) point]);
183 bigrecy(mant);
184 quo = scm_round_quotient(num, den);
185 if (pmantexp2dbl(quo, point) != f) {
And then in scm_round_quotient it fails the assert at line 322:
319 #ifdef BIGDIG
320 if (NINUMP(num)) {
321 long w;
322 ASRTER(NIMP(num) && BIGP(num), num, ARG1, s_rquotient);
323 if (NINUMP(den)) {
324 ASRTGO(NIMP(den) && BIGP(den), badden);
325 return divbigbig(BDIGITS(num), NUMDIGS(num), BDIGITS(den),
NUMDIGS(den),
326 BIGSIGN(num) ^ BIGSIGN(den), 3);
327 }
I can't say I can really follow what the code is doing here, but from
the error SCM throws:
;ERROR: "/home/stevev/scm/Init5f2.scm": round-quotient: Wrong type in arg1 (0 .
0)
This suggests that the parameter "num" now refers to a recycled bignum.
Unfortunately I don't really understand *how* it got into that state
from reading the code.
Re: [Scm-discuss] 5f2 regression: r4rstest.scm fails on 32-bit, Aubrey Jaffer, 2017/10/09