Re: Errata for SRFI 48: Intermediate Format Strings
"Arthur A. Gleckler" <[email protected]> Sat, 28 Oct 2017 21:48:04 -0700
| Newsgroups | gmane.lisp.scheme.srfi.srfi-48 |
|---|---|
| Message-ID | <CALnw4LLRfP4D=Eaj50SmnsZktCfh7T61MF-MXEFW76cB=QopKQ@mail.gmail.com> |
--94eb2c05664872ad4b055ca83bf8 Content-Type: text/plain; charset="UTF-8" X-SL-Modified: truncated_text I've just published another refinement, also submitted by Mr. Hamayama, to the reference implementation of SRFI 48. (Thanks yet again!) Here's his description: I found that the behavior of format ~F is determined by the implementation of 'number->string'. If (number->string (exact->inexact 0.0003)) returns "0.0003", (format "~1,2F" 0.0003) returns "0.00". If (number->string (exact->inexact 0.0003)) returns "3.0e-4", (format "~1,2F" 0.0003) returns "3.00e-4". I think this behavior should be customizable but it seems difficult. So, I defined three procedures near the top of code and added a comment that explains them. If system provides a kind of 'number->string' that can select whether output is fixed-point notation or exponential notation, user can use it by overwriting these procedures. Also, I refactored some code and confirmed all tests are passed in the following environment. OS: Windows 8.1 (64bit) DevTool: MSYS2/MinGW-w64 (64bit) (gcc version 7.1.0 (Rev2, Built by MSYS2 project)) Scheme: Gauche v0.9.6_pre4, Sagittarius v0.8.4, Racket v6.7 Here's the diff: < https://github.com/scheme-requests-for-implementation/srfi-48/compare/e19da08d310454ce5c52f2aa28683abfe0490e50...d35962746b6ccf25ce7490fdf059305e8c5d5949 > Regards, SRFI Editor --94eb2c05664872ad4b055ca83bf8 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">I= 9;ve just published another refinement, also submitted by Mr. Hamayama, to = the reference implementation of SRFI 48.=C2=A0 (Thanks yet again!)</div><di= v class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">Here's his= description:</div><div class=3D"gmail_quote"><br></div><div class=3D"gmail= _quote"><div class=3D"gmail_quote">=C2=A0 I found that the behavior of form= at ~F is</div><div class=3D"gmail_quote">=C2=A0 determined by the implement= ation of</div><div class=3D"gmail_quote">=C2=A0 'number->string'= .</div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2= =A0 If (number->string (exact->inexact 0.0003))</div><div class=3D"gm= ail_quote">=C2=A0 returns "0.0003", (format "~1,2F" 0.0= 003)</div><div class=3D"gmail_quote">=C2=A0 returns "0.00".</div>= <div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2=A0 If (= number->string (exact->inexact 0.0003))</div><div class=3D"gmail_quot= e">=C2=A0 returns "3.0e-4", (format "~1,2F" 0.0003)</di= v><div class=3D"gmail_quote">=C2=A0 returns "3.00e-4".</div><div = class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2=A0 I think t= his behavior should be customizable but</div><div class=3D"gmail_quote">=C2= =A0 it seems difficult.</div><div class=3D"gmail_quote"><br></div><div clas= s=3D"gmail_quote">=C2=A0 So, I defined three procedures near the top of</di= v><div class=3D"gmail_quote">=C2=A0 code and added a comment that explains = them.</div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">= =C2=A0 If system provides a kind of 'number->string'</div><div c= lass=3D"gmail_quote">=C2=A0 that can select whether output is fixed-point</= div><div class=3D"gmail_quote">=C2=A0 notation or exponential notation, use= r can use</div><div class=3D"gmail_quote">=C2=A0 it by overwriting these pr= ocedures.</div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quo= te">=C2=A0 Also, I refactored some code and confirmed all</div><div class= =3D"gmail_quote">=C2=A0 tests are passed in the following environment.</div= ><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2=A0 OS:= Windows 8.1 (64bit) DevTool: MSYS2/MinGW-w64</div><div class=3D"gmail_quot= e">=C2=A0 (64bit) (gcc version 7.1.0 (Rev2, Built by MSYS2</div><div class= =3D"gmail_quote">=C2=A0 project)) Scheme: Gauche v0.9.6_pre4,</div><div cla= ss=3D"gmail_quote">=C2=A0 Sagittarius v0.8.4, Racket v6.7</div></div><div c= lass=3D"gmail_quote"><br></div><div class=3D"gmail_quote">Here's=C2=A0t= he diff:<br><br>=C2=A0 <<a href=3D"https://github.com/scheme-requests-fo= r-implementation/srfi-48/compare/e19da08d310454ce5c52f2aa28683abfe0490e50..= .d35962746b6ccf25ce7490fdf059305e8c5d5949">https://github.com/scheme-reques= ts-for-implementation/srfi-48/compare/e19da08d310454ce5c52f2aa28683abfe0490= e50...d35962746b6ccf25ce7490fdf059305e8c5d5949</a>><br>=C2=A0<br>Regards= ,<br><br></div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quo= te">SRFI Editor</div></div></div> --94eb2c05664872ad4b055ca83bf8--