Re: Bug in srfi-48?

"Arthur A. Gleckler" <[email protected]> Wed, 11 Oct 2017 14:32:55 -0700
Newsgroups gmane.lisp.scheme.srfi.srfi-48
Message-ID <CALnw4LKy3WvEoto26LoYXe33=sdLiHk23CsvpnaDiH5snCemMg@mail.gmail.com>
--001a113966fcf2e57f055b4c2b14
Content-Type: multipart/alternative; boundary="001a113966fcf2e57b055b4c2b12"

--001a113966fcf2e57b055b4c2b12
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-SL-Modified: truncated_text

On Wed, Oct 11, 2017 at 1:36 PM, Donald Allen <[email protected]>
wrote:


> Maybe this will help:
>

Thanks.  I tried your examples in both Gambit and Guile.  They worked fine
in Guile, but in Gambit, I got the same results you did.  It turns out that
this is because number->string in Gambit doesn't prefix numbers whose
absolute value is less than one with a zero, i.e. it produces ".997"
instead of "0.997".  However, compose-with-digits assumes the latter.

I've attached a fix for this bug.  Note that I have not checked for this
problem on all code paths.

I've included Ken Dickey, the author of SRFI 48, among the recipients in
case he would like to comment =E2=80=94 or approve of my applying the patch=
 to the
public implementation as an erratum.

For reference, here's the archive of the discussion so far:

<goog_639612265>
  https://srfi-email.schemers.org/srfi-48/dates/2017/10

Thanks.

--001a113966fcf2e57b055b4c2b12
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-SL-Modified: truncated_html

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On W=
ed, Oct 11, 2017 at 1:36 PM, Donald Allen <span dir=3D"ltr">&lt;<a href=3D"=
mailto:[email protected]" target=3D"_blank">[email protected]</a>=
&gt;</span> wrote:<br><div>=C2=A0</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">Maybe this will help:<br></blockquote></div><br></div><div cl=
ass=3D"gmail_extra">Thanks.=C2=A0 I tried your examples in both Gambit and =
Guile.=C2=A0 They worked fine in Guile, but in Gambit, I got the same resul=
ts you did.=C2=A0 It turns out that this is because <font face=3D"monospace=
, monospace">number-&gt;string</font> in Gambit doesn&#39;t prefix numbers =
whose absolute value is less than one with a zero, i.e. it produces &quot;.=
997&quot; instead of &quot;0.997&quot;.=C2=A0 However, <font face=3D"monosp=
ace, monospace">compose-with-digits</font> assumes the latter.</div><div cl=
ass=3D"gmail_extra"><br></div><div class=3D"gmail_extra">I&#39;ve attached =
a fix for this bug.=C2=A0 Note that I have not checked for this problem on =
all code paths.</div><div class=3D"gmail_extra"><br></div><div class=3D"gma=
il_extra">I&#39;ve included Ken Dickey, the author of SRFI 48, among the re=
cipients in case he would like to comment=C2=A0=E2=80=94 or approve of my a=
pplying the patch to the public implementation as an erratum.</div><div cla=
ss=3D"gmail_extra"><br></div><div class=3D"gmail_extra">For reference, here=
&#39;s the archive of the discussion so far:</div><div class=3D"gmail_extra=
"><a href=3D"goog_639612265"><br></a></div><div class=3D"gmail_extra">=C2=
=A0=C2=A0<a href=3D"https://srfi-email.schemers.org/srfi-48/dates/2017/10">=
https://srfi-email.schemers.org/srfi-48/dates/2017/10</a><br></div><div cla=
ss=3D"gmail_extra"><br></div><div class=3D"gmail_extra">Thanks.</div></div>

--001a113966fcf2e57b055b4c2b12--
--001a113966fcf2e57f055b4c2b14
X-Attachment-Id: f_j8njxaf00
Content-Type: text/plain; charset="US-ASCII"; name=srfi-48-patch.txt
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="srfi-48-patch.txt"
X-SL-Modified: truncated_text

LS0tIC9ob21lL2FydGh1ci90bXAvc3JmaS00OC5zY20ufjF+CTIwMTctMTAtMTEgMTM6NTE6MTgu
Mjg1NTQ5NzQ3IC0wNzAwCisrKyAvaG9tZS9hcnRodXIvdG1wL3NyZmktNDguc2NtCTIwMTctMTAt
MTEgMTQ6MjQ6NDQuNTAzMTQ3ODcxIC0wNzAwCkBAIC04MCwxMSArODAsMTMgQEAKICAgICAgICAg
ICAgICAgICAgICAgICAgKG5ldy1mcmFjCiAgICAgICAgICAgICAgICAgICAgICAgICAoc3Vic3Ry
aW5nIHRlbXAtc3RyIDAgZGlnaXRzKSkKICAgICAgICAgICAgICAgICAgICAgICkKLSAgICAgICAg
ICAgICAgICAgKHN0cmluZy1hcHBlbmQKLSAgICAgICAgICAgICAgICAgIChpZiBjYXJyeT8gKG51
bWJlci0+c3RyaW5nICgrIDEgKHN0cmluZy0+bnVtYmVyIHByZS1zdHIpKSkgcHJlLXN0cikKLSAg
ICAgICAgICAgICAgICAgICIuIgotICAgICAgICAgICAgICAgICAgbmV3LWZyYWMKLSAgICAgICAg
ICAgICAgICAgIGV4cC1zdHIpKSkKKwkJIChsZXQgKCAocHJlLXN0ciogKGlmIChzdHJpbmc9PyBw
cmUtc3RyICIiKSAiMCIgcHJlLXN0cikpCisJCSAgICAgICkKKwkJICAgKHN0cmluZy1hcHBlbmQK
KwkJICAgIChpZiBjYXJyeT8gKG51bWJlci0+c3RyaW5nICgrIDEgKHN0cmluZy0+bnVtYmVyIHBy
ZS1zdHIqKSkpIHByZS1zdHIpCisJCSAgICAiLiIKKwkJICAgIG5ldy1mcmFjCisJCSAgICBleHAt
c3RyKSkpKQogICAgICAgICAgKSApICkKICAKICAgICAgICAgIChkZWZpbmUgKGZvcm1hdC1maXhl
ZCBudW1iZXItb3Itc3RyaW5nIHdpZHRoIGRpZ2l0cykgOyByZXR1cm5zIGEgc3RyaW5nCg==

--001a113966fcf2e57f055b4c2b14--