From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Newsgroups: gmane.emacs.bugs Subject: bug#25557: Documentation of format doesn't describe "g" accurately Date: Sat, 28 Jan 2017 11:18:44 -0500 Message-ID: <2763023c-ff54-ea65-c1b0-0c22e948f48a@live.com> References: <78ace0d5-59f1-0d7d-1f0e-b589a947d76c@live.com> <83poj7zika.fsf@gnu.org> <83a8abyzqs.fsf@gnu.org> <1b896eed-9041-83d3-bd46-cde7e534223e@live.com> <837f5fyy09.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="L71lkkqhIfGfPUD5Uf0tPWrTNxT43tHEH" X-Trace: blaine.gmane.org 1485620417 18523 195.159.176.226 (28 Jan 2017 16:20:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 28 Jan 2017 16:20:17 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 Cc: 25557@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 28 17:20:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXVjS-0003oC-7e for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jan 2017 17:20:06 +0100 Original-Received: from localhost ([::1]:52367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXVjX-0005Z9-HX for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jan 2017 11:20:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXVjR-0005Xt-Rl for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2017 11:20:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXVjO-0000lN-Ml for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2017 11:20:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51127) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXVjO-0000lJ-JR for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2017 11:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cXVjO-0003Go-9g for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2017 11:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2017 16:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25557-submit@debbugs.gnu.org id=B25557.148562034812505 (code B ref 25557); Sat, 28 Jan 2017 16:20:02 +0000 Original-Received: (at 25557) by debbugs.gnu.org; 28 Jan 2017 16:19:08 +0000 Original-Received: from localhost ([127.0.0.1]:49326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXViV-0003Fd-MW for submit@debbugs.gnu.org; Sat, 28 Jan 2017 11:19:08 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.134]:52400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXViS-0003F5-Uw for 25557@debbugs.gnu.org; Sat, 28 Jan 2017 11:19:06 -0500 Original-Received: from [18.111.113.197] ([18.111.113.197]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.168]) with ESMTPSA (Nemesis) id 0M0MwL-1cCgc00C6f-00ucNm; Sat, 28 Jan 2017 17:18:57 +0100 In-Reply-To: <837f5fyy09.fsf@gnu.org> X-Provags-ID: V03:K0:JH8xDfNWLo8EJ3oH6KVXCPsH6sM5A4oBM4xIXQtzGhawIeG6BzZ OjjWVCd31vO+oIlGIOlr4QD2EBENDNaRIxB9kQtsh1H4MxJqQJuE4V0qnmpZMZBvJAVijli jrNgfUlMYA1HxTsMyytZIhs13n0sUuVmx1mpICtsw7bCwAPJ2c5XdIAr2ne+91PL6Bd25c/ YDbORWkBTCMzvSCHvXubw== X-UI-Out-Filterresults: notjunk:1;V01:K0:ZnLlp45emkg=:/ozDVhhpSyvoveS5gCCMAA OXhyE23az0mlf9CYY1Rybk/nLW0uamYitd5zM+5MpEQc5+sRhi4EbhKiF20Fek5nP59c4UiQq v10gXdiE5xaiQxUoIbgVkIgJ7FvSQAkKGcw7+poWMSQ98xmtty1SzVV7LeyTXHLQb1hwSm7zb boLv2zxHJNBGG+j2Gwhm6b2tlGXK1FegSOB7PkQg/qFWm3678O2HxaAv3J/XX1lLwrJ1RxElQ 8SMCgE74ug2Po4Eb9daC6PthQRtp0obOwfQp6YT2tZDcqln+dci/By3LDuJaRmpRgA/upVFIP rqIZ4/AnuoyY2wteCV/E9FFCklvn3UNjN8H2t5XiHBYnWDwbmpoonPYiqPQxyG+qRfyCmzcmR WKPN2U7iCsnZePPGA6XDSA8+W2rUfHGtxzTIrJd5AhWRTzyiTQu5uWWHVTeAX/SZEKET2XB/f Kl2irTcsr3JFCwa9BJwPszT0/sYLtWE4bkoTzHNLslPDbrweFuqfNLTGmmr6GntOV9+hABhk8 Jt2FISTCFbHIvdOLZCD8BgTUWpVXnep1ARDkzEKvjOY/AtQXkD8W9fhxxRjTuEFdr81le0p9F ULVAdUhCa8ajKMKLbMN7twHitVSJAdAAl/hCWxheck0aeUmjdkI07BDCSJRdDOUeuhj9txmxp zGaZ45PrRw+dWpsfP4jpyUncuDDTfYdIrMLlVd9K6iEbOb1uR6HSvaD8dOO9t1lt5KDk= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128723 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --L71lkkqhIfGfPUD5Uf0tPWrTNxT43tHEH Content-Type: multipart/mixed; boundary="wPmT6AbpP0PpgEbUQfTVmMP1S4WtJjbWA"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: Eli Zaretskii Cc: 25557@debbugs.gnu.org Message-ID: <2763023c-ff54-ea65-c1b0-0c22e948f48a@live.com> Subject: Re: bug#25557: Documentation of format doesn't describe "g" accurately References: <78ace0d5-59f1-0d7d-1f0e-b589a947d76c@live.com> <83poj7zika.fsf@gnu.org> <83a8abyzqs.fsf@gnu.org> <1b896eed-9041-83d3-bd46-cde7e534223e@live.com> <837f5fyy09.fsf@gnu.org> In-Reply-To: <837f5fyy09.fsf@gnu.org> --wPmT6AbpP0PpgEbUQfTVmMP1S4WtJjbWA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2017-01-28 11:01, Eli Zaretskii wrote: >> Cc: 25557@debbugs.gnu.org >> From: Cl=C3=A9ment Pit--Claudel >> Date: Sat, 28 Jan 2017 10:45:09 -0500 >> >>>> I'd like something like this (with a hypothetical %q): >>>> >>>> (format "%.3q" 3) =E2=87=92 "3" >>>> (format "%.3q" 3.00) =E2=87=92 "3" >>>> (format "%.3q" 3.30) =E2=87=92 "3.3" >>>> (format "%.3q" 3.05) =E2=87=92 "3.05" >>>> (format "%.3q" 3.352) =E2=87=92 "3.35" >>>> (format "%.3q" 3100000) =E2=87=92 "3100000" >>>> >>>> This is in fact just the same as 'g', except for the last entry (%g = produces "3.1e+06"). Is this achievable? >>> >>> Yes, if you use "%.7g". In general, use "%.Ng" if you want up to N >>> digits in the printed representation. >>> >>> Does that answer your question? >> >> Almost: though this works for the last example, it breaks the one befo= re the last (I'm looking for a format specifier that would constrain the = number of decimals, not the number of digits, so that (format "%.3q" 30.3= 52) would produce "30.35" =E2=80=94 maybe all these examples should have = had %.2q instead of %.3q, in fact). >=20 > Then maybe you want %.2f? No, that always prints decimals. > If not, then perhaps you should explain what are you trying to > accomplish? Why is it important to see 3.35 when the value is 3.352, > but see all the trailing zeros for 3100000? It sounds like a > contradiction to me. I'm trying to get the shortest representation of a decimal number, rounde= d to .01, not using scientific/exponential notation. I'm using values co= mputed in ELisp to produce CSS style sheets, which until recently didn't = allow for exponential notation. I'd like these stylesheets to be readabl= e, so 100% is better 100.00%, and 3.35em is better than 3.35004em. If my = code is fed a value of 5000px, I don't want it converted to 5e+3px, becau= se many browsers don't know how to parse that. Thanks! Cl=C3=A9ment. --wPmT6AbpP0PpgEbUQfTVmMP1S4WtJjbWA-- --L71lkkqhIfGfPUD5Uf0tPWrTNxT43tHEH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYjMRkAAoJEPqg+cTm90wj8NUP+wSMindBhWcWyiAR2Fv4uT7l dVcK70i8LktHSQsL2VaUA2E9o/jqLKFBaQY4bs++87Xml8E5HgKpA6OD0aLho7fq BmEnPTzPKlxJ0IHm/GsnsIB/H+VzyLeB8iOz+LYKDIfAnnzHeJB/mnqRaaoFFZ00 OozmSiAab54sng6QorJ9U5FJkeCcUoDN+P1qAFkY+B+OboJ9DtraZZgZRFeLsc5m VwgvhF3bh4/eKb8oXJa362pYrB+s5Jx6xRB/L97VXD3vw/7gZutYyaWAnFzYEvze iktx6ML552dl9rTL0mWayFwPb86uIlkbffYrlnejut/G/NmCulCDozdZLf4m1dWM uDIBjftSI7M7xOMxHJBmGSHJ9tIe9bbCGJrGgvq6966A//Cn77jPOl9hKxNAP9rf oxst9I2qC2+mgkp8t0EAM5GzpvGr0TGHI6nvfE1oBTI2268IPk1OQqgUd9KBMuSB jsAvoSn2zaIRV6Kf8hvqUHQOQpkyi8rgRhtkLN8djBlyR2uyuHt5TIAJYZPRDjLa ucM31BLC2xi26OsF5YYlKaT21NMbdGBJoJQyfwUtkzgYDe09wgEmzFdjKvMv0U10 AOQ72JW2LeVdkqvfh6RBeTHMQT9qu6hWioONp56ezClwKXX4PXv1sRu0ax2wN+wW wKtjuLGm+9/Pdavb6ysp =yiyL -----END PGP SIGNATURE----- --L71lkkqhIfGfPUD5Uf0tPWrTNxT43tHEH--