220 24854 <47b6a73e-1ead-4536-b2e4-ca00402a2324@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: u97234@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Deprecating to_string() for floating point types
 and introducing a replacement
Date: Mon, 29 Feb 2016 15:26:49 -0800 (PST)
Lines: 316
Approved: news@gmane.org
Message-ID: <47b6a73e-1ead-4536-b2e4-ca00402a2324@isocpp.org>
References: <7c6c597d-6d77-4675-8560-295c7feacc04@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1064_1984918039.1456788409595"
X-Trace: ger.gmane.org 1456788419 4978 80.91.229.3 (29 Feb 2016 23:26:59 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 29 Feb 2016 23:26:59 +0000 (UTC)
Cc: u97234@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCE2PZXXWUFBBOVH2O3AKGQETLPMX4A@isocpp.org Tue Mar 01 00:26:55 2016
Return-path: <std-proposals+bncBCE2PZXXWUFBBOVH2O3AKGQETLPMX4A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f199.google.com ([209.85.160.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCE2PZXXWUFBBOVH2O3AKGQETLPMX4A@isocpp.org>)
	id 1aaXDI-0003io-RL
	for gclcip-std-proposals@m.gmane.org; Tue, 01 Mar 2016 00:26:53 +0100
Original-Received: by mail-yk0-f199.google.com with SMTP id z7sf267334236yka.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 29 Feb 2016 15:26:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=O264vGMkvQ0cL0nxZWLlX3UzuVVfmRgNRCdjMzWNFmU=;
        b=S9vYyi7IYNPLHrTd1mGZt/PISdFA/gFFCFRxzWc5PtfxhSHzSlZVzyY89kWVm9lnmJ
         iM+9+qF5fg3fmISxgE5GhIpyDa8evj1ro+l7El/Oow1T1aMB4gNRcbn6DfuD1jGoLkXj
         ZXWKoifAgusQmaH6/txTo3N/mYHH3uEEm7bIcHFsdM+W2RloMgiDekXAT7qbYacdCMJL
         kYpSgbNY9xpK7LSdlNE4ybD0yQo7xUzf7bXRiihU6NgYPrU8cd/lQvjzCIi2PQutZ3YW
         tIACIwBNjWvFASfZi1Qwhx97C3liZq/xovQGPMy1itAQK65biSLT04hbzR/mJhjR7mN1
         RfHQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=O264vGMkvQ0cL0nxZWLlX3UzuVVfmRgNRCdjMzWNFmU=;
        b=hCoGbqO+YwZ6FW3giiRDNBjYAW45KdZWWuGYytvLqqhZtCReVo4jR7SzJNDU3NkUIX
         cgBWhOrh6N191F4+08fbR3ah8Q86SJfW82q+792pNE+2OFrYiRntgTpPgrV0tAYkVXlS
         rgJUSl1TCcM4+xrkQE3sYupu9QjXpIz/Lt1MeX66vsT7UjFOWFN8RWpxmOs40e9KR2is
         YguThbNunMfC7g7M1cEa1u4KE+Coa37gdxvq+lMU6GHj94UjI3YZJdfbGNBUgb0cMg8X
         sLJMHCbU/9W9jsAjuYIthrtOQrZfzU5oHSn1y29q4XJ0/k8w1CHCcFK9T1qHv1Bmnahu
         Aqcg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=O264vGMkvQ0cL0nxZWLlX3UzuVVfmRgNRCdjMzWNFmU=;
        b=hvN/PQFsSHS8Jt0oHyLRtpxCDbGR7c2Ck/DNThu8cnf4G9PcPMUE/nI1LEnHnIACQ2
         w8com3ldCAk5qDlUqJUo5c1KLkgXc3l9ReWdylGT3sw8bJLXcGU5kdQ6QRoEiAYCOaUm
         shnXagSy7nINovAKYPBvLyplREtXm8hMIPmZyNYcRp87v4ugtE6X02w3vIVakmhhkGZi
         LAR8FnBNBBGAZ5dB897wT3zqdU/WSIHTYer2B2tpZh8+4L0D2IoP9YVya36ENW6XfBcW
         sKLy6dZEfaoUTwgBNbfv+Is5ZfRUiVAG3AC2b6ZGIUUtZreMQLghLnRlv510iavTLAQt
         x34Q==
X-Gm-Message-State: AD7BkJIf85Z4i5owyG6C4nar4kuJZMKnIMhGOS5aVBkc9yMOAX/+akhRnf6ypoWMLaXBiQ==
X-Received: by 10.140.240.129 with SMTP id l123mr14514224qhc.8.1456788412001;
        Mon, 29 Feb 2016 15:26:52 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.41.212 with SMTP id p203ls660679iop.5.gmail; Mon, 29 Feb
 2016 15:26:50 -0800 (PST)
X-Received: by 10.50.153.68 with SMTP id ve4mr14184igb.8.1456788410653;
        Mon, 29 Feb 2016 15:26:50 -0800 (PST)
In-Reply-To: <7c6c597d-6d77-4675-8560-295c7feacc04@isocpp.org>
X-Original-Sender: u97234@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:24854
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/24854>

------=_Part_1064_1984918039.1456788409595
Content-Type: multipart/alternative; 
	boundary="----=_Part_1065_885126106.1456788409596"

------=_Part_1065_885126106.1456788409596
Content-Type: text/plain; charset=UTF-8

Thanks for the responses.

@d.h.go...

I haven't, might be a good idea to do so.

@Moritz Klammler

About the inconsistency with integer versions, importance of round-tripping 
and hexfloat

The inconsistency is in some sense hard to evaluate because, as mentioned, 
the original paper did not specify the purpose of to_string(). In many use 
cases such as human readable files using hexfloat might be a fundamental 
change to usability: for example I would reckon that it's quite different 
for interoperability with other tools (spreadsheet etc.) to have a file 
with %g-formatted values compared to hexfloats. And using it is even harder 
to justify when one can use non-lossy decimal representation. But requiring 
round-tripping might actually be indirect: what if it is not required? What 
should to_string() do? If the suggestion is a lossy precision, the 
arguments can directly address the question why the chosen number of digits 
can be considered a "fits for all" choice. Of course round-tripping format 
does not fit for all, but I considered loss of information much bigger an 
issue than having an inconvenience in the output; standard can't make a 
guarantee that the formatted looks nice and has the right number of digits 
for everyone, but it could guarantee some aspects of information 
preservation for everyone.

hexfloat is by my understanding available through options 'a' and 'A'.


Likelihood of causing breaking changes

Generally speaking if a developer has created an application relying on a 
standard guaranteed behaviour, any change can be a breaking one (here for 
example one could be assuming that the result does not contain character 
'e'). Especially the silent runtime behaviour change is potentially 
hazardous. 

Use of exceptions

Unfortunately the noexcept seems to be out of question due to the potential 
allocation of std::string. thanks for pointing that out. Why the (direct) 
use of exceptions such as std::invalid_argument does not seem appropriate 
is that it seems a bit too severe a consequence that failing to create a 
string would in practice often crash the application; i.e. people would 
forget to use try-catch with to_string().  It's not a serious error if 
conversion fails as the function can simply report "I got garbage, I can't 
give an answer and you can check this from the return value if interested". 
If the failure is a serious error for the application, it should handle it 
accordingly. But this is more a question of when and why the standard seems 
appropriate to use exception and how to apply it in this case if this ever 
proceed to such stage. 

"Finally, why does it have to be a new function?"

Because any change is potentially a breaking change; if experienced 
standard people feel the expected consequences are negligible, personally I 
would probably use to_string() more happily than to_string_f(). And while 
"%g" would have been better than "%f" in some sense, %g implies only 6 
significant digits which also has a severe problem:

    const auto t = std::time(nullptr);
    const auto d = static_cast<double>(t);
    if (t == d)
    {
        char szBuffer[128];
        std::cout << "Values are identical\n"
                << "to_string(t) = " << std::to_string(t) << '\n'
                << "to_string(d) = " << std::to_string(d) << '\n';
        sprintf(szBuffer, "%g", d);
        std::cout << "to_string(d) if %g instead of %f = " << szBuffer << 
'\n';
    }


Example output:
Values are identical
to_string(t) = 1456783429
to_string(d) = 1456783429.000000
to_string(d) if %g instead of %f = 1.45678e+09 

So with %g identical values would result to fundamentally different strings 
depending on type. So simply changing %f -> %g might result to loss of 
precision and severely break existing code on runtime. And if setting a 
higher precision to avoid this, the question is how precise? The proposal 
would make it easy: it's precise enough that there's no need to worry about 
it.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/47b6a73e-1ead-4536-b2e4-ca00402a2324%40isocpp.org.

------=_Part_1065_885126106.1456788409596
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks for the responses.<br><br>@d.h.go...<div dir=3D"ltr=
"><br>I haven&#39;t, might be a good idea to do so.<br><br>@Moritz Klammler=
<br><br><div style=3D"margin-left: 40px;">About the inconsistency with inte=
ger versions, importance of round-tripping and hexfloat<br></div><br>The in=
consistency is in some sense hard to evaluate because, as mentioned, the or=
iginal paper did not specify the purpose of to_string(). In many use cases =
such as human readable files using hexfloat might be a fundamental change t=
o usability: for example I would reckon that it&#39;s quite different for i=
nteroperability with other tools (spreadsheet etc.) to have a file with %g-=
formatted values compared to hexfloats. And using it is even harder to just=
ify when one can use non-lossy decimal representation. But requiring round-=
tripping might actually be indirect: what if it is not required? What shoul=
d to_string() do? If the suggestion is a lossy precision, the arguments can=
 directly address the question why the chosen number of digits can be consi=
dered a &quot;fits for all&quot; choice. Of course round-tripping format do=
es not fit for all, but I considered loss of information much bigger an iss=
ue than having an inconvenience in the output; standard can&#39;t make a gu=
arantee that the formatted looks nice and has the right number of digits fo=
r everyone, but it could guarantee some aspects of information preservation=
 for everyone.<br><br>hexfloat is by my understanding available through opt=
ions &#39;a&#39; and &#39;A&#39;.<br><br><br><div style=3D"margin-left: 40p=
x;">Likelihood of causing breaking changes<br></div><br>Generally speaking =
if a developer has created an application relying on a standard guaranteed =
behaviour, any change can be a breaking one (here for example one could be =
assuming that the result does not contain character &#39;e&#39;). Especiall=
y the silent runtime behaviour change is potentially hazardous. <br><br><di=
v style=3D"margin-left: 40px;">Use of exceptions<br></div><br>Unfortunately=
 the noexcept seems to be out of question due to the potential allocation o=
f std::string. thanks for pointing that out. Why the (direct) use of except=
ions such as std::invalid_argument does not seem appropriate is that it see=
ms a bit too severe a consequence that failing to create a string would in =
practice often crash the application; i.e. people would forget to use try-c=
atch with to_string().=C2=A0 It&#39;s not a serious error if conversion fai=
ls as the function can simply report &quot;I got garbage, I can&#39;t give =
an answer and you can check this from the return value if interested&quot;.=
 If the failure is a serious error for the application, it should handle it=
 accordingly. But this is more a question of when and why the standard seem=
s appropriate to use exception and how to apply it in this case if this eve=
r proceed to such stage. <br><br><div style=3D"margin-left: 40px;">&quot;Fi=
nally, why does it have to be a new function?&quot;<br></div><br>Because an=
y change is potentially a breaking change; if experienced standard people f=
eel the expected consequences are negligible, personally I would probably u=
se to_string() more happily than to_string_f(). And while &quot;%g&quot; wo=
uld have been better than &quot;%f&quot; in some sense, %g implies only 6 s=
ignificant digits which also has a severe problem:<br><br><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"></span><div class=3D"prettyprint" =
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, =
187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> t </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">time</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">nullptr</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> d </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">static_cast</span><span style=3D"color: #080;" class=3D"styled-by-p=
rettify">&lt;double&gt;</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">if<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">t </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> d</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">char</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> szBuffer</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">[</span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">128</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">];</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">cout </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-=
prettify">&quot;Values are identical\n&quot;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">=
&quot;to_string(t) =3D &quot;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">to_str=
ing</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">t</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D=
"styled-by-prettify">&#39;\n&#39;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;to_s=
tring(d) =3D &quot;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">to_string</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">d</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&#39;\n&#39;</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 sprintf</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">szBuffer</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pr=
ettify">&quot;%g&quot;</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">cout </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;to_s=
tring(d) if %g instead of %f =3D &quot;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> szBuffer </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&#39;\n&#39;</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span></div></code></div><br><br>Example output:<br><div class=3D"prett=
yprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(18=
7, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word=
;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #606;" class=3D"styled-by-prettify">Values</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> are identical<br>to_string</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">t</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prett=
ify">1456783429</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>to_string</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">d=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">1456783429.000000</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>to_string</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">d</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">if</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">%</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">g instead of </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">%</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">f </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" clas=
s=3D"styled-by-prettify">1.45678e+09</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span></div></code></div><br>So with %g identic=
al values would result to fundamentally different strings depending on type=
.. So simply changing %f -&gt; %g might result to loss of precision and seve=
rely break existing code on runtime. And if setting a higher precision to a=
void this, the question is how precise? The proposal would make it easy: it=
&#39;s precise enough that there&#39;s no need to worry about it.<br></div>=
</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/47b6a73e-1ead-4536-b2e4-ca00402a2324%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/47b6a73e-1ead-4536-b2e4-ca00402a2324=
%40isocpp.org</a>.<br />

------=_Part_1065_885126106.1456788409596--
------=_Part_1064_1984918039.1456788409595--

.
