Re: Bug in srfi-48?
Donald Allen <[email protected]> Thu, 12 Oct 2017 15:42:19 -0400
| Newsgroups | gmane.lisp.scheme.srfi.srfi-48 |
|---|---|
| Message-ID | <CAPsTYby8psoZVqEVNCrYr8=M0isa+oRzW0dPHh1=qPFcANt6qA@mail.gmail.com> |
--001a113c27e00edcfa055b5ebd57 Content-Type: text/plain; charset="UTF-8" X-SL-Modified: truncated_text On 12 October 2017 at 15:07, Arthur A. Gleckler <[email protected]> wrote: > On Thu, Oct 12, 2017 at 6:04 AM, Donald Allen <[email protected]> > wrote: > > >> Thanks for the quick response. From your description of the patch, it >> sounds like you addressed the error that occurs using Gambit. But did >> you also have a look at the odd rounding behavior I reported in my >> first message? >> > > earlier: > > 3> (/ (round (* 1.997554209949891 100)) 100) >> 2. > > > I get the same result with MIT Scheme. I must be missing something. Why > do you consider it wrong? According to R7RS (and probably earlier versions > of the standard),"round returns the closest integer to x, rounding to even > when x is halfway between two integers." > Sorry, I wasn't clear. I was talking about this: 2> (format "~a & ~7,2F\\%\\\\\n" "Framingham Mass Muni Purpose Loan" 1.997554209949891) "Framingham Mass Muni Purpose Loan & 2.10\\%\\\\\n" Why does a ~7,2 formatting of something just under 2 result in 2.1? When, as you say, 3> (/ (round (* 1.997554209949891 100)) 100) 2. --001a113c27e00edcfa055b5ebd57 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SL-Modified: truncated_html <div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo= te">On 12 October 2017 at 15:07, Arthur A. Gleckler <span dir=3D"ltr"><<= a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= </a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin= :0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"= ><div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><sp= an class=3D"gmail-">On Thu, Oct 12, 2017 at 6:04 AM, Donald Allen <span dir= =3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">do= [email protected]</a>></span> wrote:<br><div>=C2=A0</div><blockquote = class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol= id rgb(204,204,204);padding-left:1ex"> Thanks for the quick response. From your description of the patch, it<br> sounds like you addressed the error that occurs using Gambit. But did<br> you also have a look at the odd rounding behavior I reported in my<br> first message?<br></blockquote><div><br></div></span><div>earlier:</div><sp= an class=3D"gmail-"><div><br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex"><span style=3D"font-size:12.8px">3> (/ (round (* 1.9975542099= 49891 100)) 100)<br></span><span style=3D"font-size:12.8px">2.</span></bloc= kquote><div><br></div></span><div>I get the same result with MIT Scheme.=C2= =A0 I must be missing something.=C2=A0 Why do you consider it wrong?=C2=A0 = According to R7RS (and probably earlier versions of the standard),"rou= nd returns the closest integer to x, rounding to even when x is halfway bet= ween two integers."<span style=3D"font-size:10pt;font-family:CMR10">= =C2=A0</span></div></div></div></div></blockquote><div><br></div><div>Sorry= , I wasn't clear. I was talking about this:</div><div><br></div><span s= tyle=3D"font-size:12.8px">2> (format "~a & ~7,2F\\%\\\\\n"= "Framingham Mass Muni Purpose Loan" 1.997554209949891)</span><br= style=3D"font-size:12.8px"><div><span style=3D"font-size:12.8px">"Fra= mingham Mass Muni Purpose Loan &=C2=A0=C2=A0=C2=A0 2.10\\%\\\\\n"<= /span></div><div><br></div><div>Why does a ~7,2 formatting of something jus= t under 2 result in 2.1? When, as you say,</div><div><br></div><div><span s= tyle=3D"font-size:12.8px">3> (/ (round (* 1.997554209949891 100)) 100)<b= r></span><span style=3D"font-size:12.8px">2.</span><br></div><div>=C2=A0</d= iv></div><br></div></div> --001a113c27e00edcfa055b5ebd57--