Fix format ~f and update tests (3rd)
hamay1010 <[email protected]> Mon, 30 Oct 2017 21:58:20 +0900
| Newsgroups | gmane.lisp.scheme.srfi.srfi-48 |
|---|---|
| Message-ID | <CACt-mtPD258C8kaL9bgNM+sM1V=Yjn00u6AF_-_UiLe1KNrJFg@mail.gmail.com> |
--001a114caab46ba276055cc331ba Content-Type: text/plain; charset="UTF-8" X-SL-Modified: truncated_text I found following error cases. ``` (a) (format "~1,0F" 1.5) -> "1." (b) (format "~1,0F" (/. 1 0)) -> "+inf." (c) (format "~1,0F" (/. -1 0)) -> "-inf." (d) (format "~1,0F" (/. 0 0)) -> "+nan." ``` For (a), (format "~1,0F" 1.5) must return "2." because 'round' of Scheme uses banker's rounding. The reason of (a) is that integer part and fractional part were processed separately. For (b)-(d), it is necessary to check +inf.0, -inf.0, +nan.0, -nan.0. I fixed these cases and updated tests. I created a pull request as follows. https://github.com/scheme-requests-for-implementation/srfi-48/pull/4 --001a114caab46ba276055cc331ba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SL-Modified: truncated_html <div dir=3D"ltr"><div>I found following error cases.</div><div>```</div><di= v>(a) (format "~1,0F" 1.5)=C2=A0 =C2=A0 =C2=A0 =C2=A0-> "= 1."</div><div>(b) (format "~1,0F" (/. 1 0))=C2=A0 -> &quo= t;+inf."</div><div>(c) (format "~1,0F" (/. -1 0)) -> &quo= t;-inf."</div><div>(d) (format "~1,0F" (/. 0 0))=C2=A0 ->= "+nan."</div><div>```</div><div><br></div><div>For (a), (format = "~1,0F" 1.5) must return "2."</div><div>because 'ro= und' of Scheme uses banker's rounding.</div><div><br></div><div>The= reason of (a) is that integer part and fractional part=C2=A0</div><div>wer= e processed separately.</div><div><br></div><div>For (b)-(d), it is necessa= ry to check +inf.0, -inf.0, +nan.0, -nan.0.</div><div><br></div><div>I fixe= d these cases and updated tests.</div><div><br></div><div><div>I created a = pull request as follows.</div><div><a href=3D"https://github.com/scheme-req= uests-for-implementation/srfi-48/pull/4">https://github.com/scheme-requests= -for-implementation/srfi-48/pull/4</a></div></div><div><br></div></div> --001a114caab46ba276055cc331ba--