[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-devel
Subject:    Re: [Sbcl-devel] Old tickets on Launchpad (was: unpretty FORMAT ~E printing)
From:       Raymond Wiker <rwiker () gmail ! com>
Date:       2021-04-20 12:05:33
Message-ID: C815847E-9350-4EC7-8F78-6868CD966CE4 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I did a bit of digging last week, and came up with a one-line patch that solves this \
problem; the patch has been attached to the ticket on Launchpad, but I'm including it \
below.

With this patch, SBCL gives a single trailing zero for ~e-formatted numbers that have \
no fractional part, bringing it in line with other implementations (Lispworks, ccl), \
and also makes SBCL conform with section 22.3.3.2 of the HyperSpec \
<http://www.lispworks.com/documentation/HyperSpec/Body/22_ccb.htm> ("no trailing zero \
digits may appear in the fraction, except that if the fraction to be printed is zero \
then a single zero digit should appear after the decimal point").

diff --git a/src/code/target-format.lisp b/src/code/target-format.lisp
index bf7bdafc0..cb68249af 100644
--- a/src/code/target-format.lisp
+++ b/src/code/target-format.lisp
@@ -707,6 +707,7 @@
                                (if atsign (write-char #\+ stream)))
                            (when lpoint (write-char #\0 stream))
                            (write-string fstr stream)
+                           (when tpoint (write-char #\0 stream))
                            (write-char (if marker
                                            marker
                                            (format-exponent-marker number))


> On 31 Aug 2020, at 15:10, Stas Boukarev <stassats@gmail.com> wrote:
> 
> Anyone subscribed should be notified. It did reach me, for example.
> 
> On Mon, Aug 31, 2020 at 3:57 PM Raymond Wiker <rwiker@gmail.com> wrote:
> > 
> > Hi,
> > 
> > I just submitted an update to a long-standing ticket on launchpad: \
> > https://bugs.launchpad.net/sbcl/+bug/883520 
> > I see that this ticket was last worked on by Nikodemus Siivola in 2011. Do I have \
> > to do something to ensure that the ticket shows up in the appropriate \
> > mailbox(es)? _______________________________________________
> > Sbcl-devel mailing list
> > Sbcl-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sbcl-devel


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
line-break: after-white-space;" class="">I did a bit of digging last week, and came \
up with a one-line patch that solves this problem; the patch has been attached to the \
ticket on Launchpad, but I'm including it below.<div class=""><br class=""></div><div \
class="">With this patch, SBCL gives a single trailing zero for ~e-formatted numbers \
that have no fractional part, bringing it in line with other implementations \
(Lispworks, ccl), and also makes SBCL conform with&nbsp;<a \
href="http://www.lispworks.com/documentation/HyperSpec/Body/22_ccb.htm" \
class="">section 22.3.3.2 of the HyperSpec</a>&nbsp;("no trailing zero digits may \
appear in the fraction, except that if the fraction to be printed is zero then a \
single zero digit&nbsp;should appear after the decimal point").</div><div \
class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">diff --git \
a/src/code/target-format.lisp b/src/code/target-format.lisp</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">index bf7bdafc0..cb68249af 100644</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">--- a/src/code/target-format.lisp</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">+++ b/src/code/target-format.lisp</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">@@ -707,6 +707,7 @@</span></div><div style="margin: \
0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; (if atsign (write-char #\+ stream)))</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (when lpoint (write-char #\0 \
stream))</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; \
line-height: normal; font-family: Menlo;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
(write-string fstr stream)</span></div><div style="margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">+ &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (when tpoint \
(write-char #\0 stream))</span></div><div style="margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
(write-char (if marker</span></div><div style="margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marker</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; (format-exponent-marker number))</span></div><div><br \
class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On 31 \
Aug 2020, at 15:10, Stas Boukarev &lt;<a href="mailto:stassats@gmail.com" \
class="">stassats@gmail.com</a>&gt; wrote:</div><br \
class="Apple-interchange-newline"><div class=""><div class="">Anyone subscribed \
should be notified. It did reach me, for example.<br class=""><br class="">On Mon, \
Aug 31, 2020 at 3:57 PM Raymond Wiker &lt;<a href="mailto:rwiker@gmail.com" \
class="">rwiker@gmail.com</a>&gt; wrote:<br class=""><blockquote type="cite" \
class=""><br class="">Hi,<br class=""><br class="">I just submitted an update to a \
long-standing ticket on launchpad: <a \
href="https://bugs.launchpad.net/sbcl/+bug/883520" \
class="">https://bugs.launchpad.net/sbcl/+bug/883520</a><br class=""><br class="">I \
see that this ticket was last worked on by Nikodemus Siivola in 2011. Do I have to do \
something to ensure that the ticket shows up in the appropriate mailbox(es)?<br \
class="">_______________________________________________<br class="">Sbcl-devel \
mailing list<br class=""><a href="mailto:Sbcl-devel@lists.sourceforge.net" \
class="">Sbcl-devel@lists.sourceforge.net</a><br \
class="">https://lists.sourceforge.net/lists/listinfo/sbcl-devel<br \
class=""></blockquote></div></div></blockquote></div><br \
class=""></div></body></html>





_______________________________________________
Sbcl-devel mailing list
Sbcl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic