From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dave Gillespie Newsgroups: gmane.emacs.bugs Subject: bug#47302: 27.1; calc math-format-number formatting for floats without decimals is unusual Date: Mon, 26 Apr 2021 14:58:12 +0000 Message-ID: References: <86k0q0nped.fsf@fsfe.org> <86v98ejr8x.fsf@fsfe.org> <0E7C5A4F-105A-4E1E-A103-BFB9C263F2BA@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29457"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jelle Licht , Stefan Kangas , "47302@debbugs.gnu.org" <47302@debbugs.gnu.org> To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 26 16:59:18 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lb2hi-0007MU-4C for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Apr 2021 16:59:18 +0200 Original-Received: from localhost ([::1]:46462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb2hh-0002GK-6e for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Apr 2021 10:59:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb2hS-0002ES-RE for bug-gnu-emacs@gnu.org; Mon, 26 Apr 2021 10:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lb2hR-0003jj-Re for bug-gnu-emacs@gnu.org; Mon, 26 Apr 2021 10:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lb2hR-0005Ec-Ow for bug-gnu-emacs@gnu.org; Mon, 26 Apr 2021 10:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dave Gillespie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Apr 2021 14:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47302 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 47302-submit@debbugs.gnu.org id=B47302.161944910620067 (code B ref 47302); Mon, 26 Apr 2021 14:59:01 +0000 Original-Received: (at 47302) by debbugs.gnu.org; 26 Apr 2021 14:58:26 +0000 Original-Received: from localhost ([127.0.0.1]:46701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb2go-0005DU-1z for submit@debbugs.gnu.org; Mon, 26 Apr 2021 10:58:26 -0400 Original-Received: from mail-mw2nam08on2087.outbound.protection.outlook.com ([40.107.101.87]:59201 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb2gl-0005DC-Dl for 47302@debbugs.gnu.org; Mon, 26 Apr 2021 10:58:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BwYpMItJmIbxdTqgZgELPRIwgvE77v00H1/dRegz2IR1/jghRH5OiNceS+7mjgPARn2iyC3hXQcBqOYOvrk2bq9T+5TQsxZn+9UUszfWd5WA/7EqKLqTxBYWAxJPVlb1Xtc/Bc1rRG/EAiqEgqJXRjkSsID0QnxrcaHp2i2DZ0Nz1DeEgvV4jleA/lMYnkIpHCtREmsw0hIh0cwwPGvJ9HFk1BzaOf4onJtpU2c8OQ2Cm2n5xSukpSx0ieeTf5l6kYpKCUbcKUV0sBdJOhxWChRg0u80FMcIdwrG30AHO+k7fUolgUdne5+nO6oPPgRQH31R+dVXV7kKLNToP4yIsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEIXUrJYUcZEHdk7VEoMUGmSJ00gXCcv1rJB9+qst6g=; b=MCxeyXBenX9d0f608RR5NmDuwv8zNqYDZ6CKH7FiAK6aC9sGuOlVll5FVLbjYAe1qTNqrY7Xnnj0X54/XphcBuCD7oUBwFwp82AvtVkR57MAjMzTsd+esy9v+0gPIlnmUyonNtAsmRWEbri0XxxPIELMCtg82Mu9x3fWyjcoUzww6gh0LESSsJvXcAyCdbCi2NM7vGaBNB5yd2RisHV/K2oHq2mjFYmhlytaB52lI9FH7Ng3m4TmY3iNbhxYT1cR9DVHnZYnsy/LZ7d3VuYWuhU6OzLruAgP1AsGjaujZBpO2yYchlr2FlITuvrCwUuVYgJTTSfaXF+8T7Wm6evhqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEIXUrJYUcZEHdk7VEoMUGmSJ00gXCcv1rJB9+qst6g=; b=c2kbsi3WFut7oTlWvW4mprZvo9Lx9cXO2918ksyDjcEs6WG9wemc+suaILWS203PuqCT7F6gag8VcRkP+g8nM6iR1tot5jmKMYF8BGt7FHLmwnrOn/4eNSnip1aWOilIffwpUlOB92T7HAd5r1SEhCSrDqnoCej+536LLVJCytE= Original-Received: from BYAPR03MB3592.namprd03.prod.outlook.com (2603:10b6:a02:ab::10) by BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Mon, 26 Apr 2021 14:58:12 +0000 Original-Received: from BYAPR03MB3592.namprd03.prod.outlook.com ([fe80::4829:5817:61ff:c447]) by BYAPR03MB3592.namprd03.prod.outlook.com ([fe80::4829:5817:61ff:c447%5]) with mapi id 15.20.4065.027; Mon, 26 Apr 2021 14:58:12 +0000 Thread-Topic: bug#47302: 27.1; calc math-format-number formatting for floats without decimals is unusual Thread-Index: AQHXNsFUtfuJlro7BUOoRdmU7hT7t6rAjZ6AgAAWPQCAABX+gIAEruoAgAGCxZA= In-Reply-To: <0E7C5A4F-105A-4E1E-A103-BFB9C263F2BA@acm.org> Accept-Language: en-US Content-Language: en-US x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcZGF2ZWdcYXBwZGF0YVxyb2FtaW5nXDA5ZDg0OWI2LTMyZDMtNGE0MC04NWVlLTZiODRiYTI5ZTM1Ylxtc2dzXG1zZy1kMDJkYTExOS1hNjlmLTExZWItYWZlMC0xNGFiYzU4NWQ3NmFcYW1lLXRlc3RcZDAyZGExMWItYTY5Zi0xMWViLWFmZTAtMTRhYmM1ODVkNzZhYm9keS50eHQiIHN6PSIyNDY5IiB0PSIxMzI2MzkyMjY4OTgwNjI1MzIiIGg9IktVWmFxN2NYUkg5WDJjRThEQXJ6c1hsMDMwST0iIGlkPSIiIGJsPSIwIiBibz0iMSIvPjwvbWV0YT4= x-dg-rorf: true authentication-results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=synaptics.com; x-originating-ip: [162.251.184.120] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a3c2e898-dcda-4c97-286c-08d908c3b669 x-ms-traffictypediagnostic: BY5PR03MB5345: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: O8uSFSwfkNfXuaLo69tTqW+c2R7PAuj3AOWeFR4sxEvP0CAbu8LmtH+4H/RaPNh1N2hF063WDD90OkFK0iHEXGCGg9ibk63GEG/IRn01GAGw4HEQURkwmzR5h5u+kQR084c+We5WxmRQauYKJ0o03typITgnP96P5S1nz+Imx/H4YSXkh2COAm5q3s5d4cd0GcuNWjEhc6NWKcB5abdNjFiiIBukU0jkHNqzsJcTA6pdOSF/xPE6C9ScbcZuszxrgFs3uvf3GA+bgMi/LCJiOlGpuDMSbD/RXnTkeYF+wp8sBHlQKQmI/vXv5FJTlPz7jTSC+Wah3IKbueV3vgmaNYc6UKjsTlkdc26lFGiQO1Zix5Doc4DEKm5+N9jtAtEqr+rbDIY/e8PBY0E2aVSxqajfLMJnJKrEEhHxfTEpngLniMcj/idtph09g5xq9w5TsvRX1DzAuIpMuFU453ZbQBOaKGs/7JTFXOT6/F2JG2n9Y3mMzEUPRGTHlD6ANGwlpvJq/AUNgeU8XK0MELBx9Rgv8w0tmxDQCUKLNFmig4jSFPyQSjplDs1pEqzJrkQNn/8MLvD7anqOFOttsNfErndDf/Vre1253lGO0mDbN/U= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR03MB3592.namprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(136003)(346002)(376002)(396003)(39850400004)(6916009)(478600001)(8676002)(316002)(54906003)(71200400001)(83380400001)(8936002)(6506007)(4326008)(66574015)(5660300002)(53546011)(7696005)(26005)(186003)(2906002)(9686003)(55016002)(38100700002)(64756008)(86362001)(122000001)(52536014)(66556008)(66946007)(76116006)(66446008)(66476007)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: B9Ea+HsA5Gmqh0gQLMLih4kn4EnKiyKxYFL3civrNbvMjCxL6GheeYCjMFpYsaU7hPaBSYJasy0ZeuouFyqpd6kwaqSdpnuyI/Yl4R9r2DWb5+qdPLR4i4e/81JV5DlkTiWn4iHLDj+GF3Xcr/RCaLNs9ww/BM/DiSbzUtjid42PjRP8M/TPUxswUMyEVHfv49/DJjmaRx4Zqai85Fm0AyU9mtK52s9ORF5EOAx0YtYC3tX4XAHzYJY5GVOhCm87EtRPWDp8LcgErpCREAEd2TKZ7XZT5ZNlCuWuitUgf4OKnic5XiEQs2AwfW7kDJVSpisTK/uBqJWyJtaBhUgJuJJVgZeC+Y+C0zzc1s2Mk358H3WSUhNpP8tbTjLqasgmOX1TntRyScfHhl1k6WctRlWG0qgO6Tuw3K7Z6P3Hr7nvwp4lGzDhaeIVO0PjL1RND0FKmqCF0L/1XAzmIlkhNN3w6/f7k5IkDferUD4vE5BKwO+IM8XmOppBSFn7lZZKMMKEUnmr0HUA734JKgy3yviik+WyTrBo33IVrB86Q4mrc0TLsdgydPrilzS6o1RW3cUntRt48d7aC8Zm3E1bf3rXKC3oB/NAu3TSYn/c0sUV8E1qd9LVOMICD2y3wrkY1/orcKpvEpORPW0AptLea57GCJd/P8UkxAeEMm0YEc2IllKyGEU3wLWonadbS0WELR8l4eCJ6aqfWhsebfe3Ez6A0pZ3ysWEzo6mvSosQopuM9czMWMwmmcooDkL Z4QQq8UWU3wvbE0PLfOQjQczO5U68sBT5gvndBcKdfQmNxIkNWBcKTl7i1iz8fNqdmAgTwgJe5Pd66vj5iDSbCayMcFoNIoKdS x-ms-exchange-transport-forked: True X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB3592.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3c2e898-dcda-4c97-286c-08d908c3b669 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2021 14:58:12.0536 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 757C7RdRyRHCJhB3sLoC1RrIAdVrewjHsew32Ar3HKop7U7DBuknurnb8+4WuDZzsRMXxr7aZxQhRKxGhZz+mA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR03MB5345 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204953 Archived-At: Yes, that patch makes sense. Thanks, and thanks for helping with this old = beast! =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 -- Dave -----Original Message----- From: Mattias Engdeg=E5rd =20 Sent: Sunday, April 25, 2021 8:54 AM To: Dave Gillespie Cc: Jelle Licht ; Stefan Kangas ; 47302= @debbugs.gnu.org Subject: Re: bug#47302: 27.1; calc math-format-number formatting for floats= without decimals is unusual CAUTION: Email originated externally, do not click links or open attachment= s unless you recognize the sender and know the content is safe. 22 apr. 2021 kl. 18.35 skrev Dave Gillespie : > Wow, it has been a long time since I got any correspondence on Calc! Good to hear from you, Dave! I just fix the occasional Calc bug now and the= n. > Calc has a C language mode ('d C' keystroke, controlled by calc-language)= . It is a good point that C mode (and probably others like it) should form= at integer-valued floats as "123.0" even if the default mode does not. If = we apply Jelle's patch, I suggest making it conditional on calc-language so= that it applies only in modes such as C mode. Or perhaps rework it as a t= ext transformation using calc-language-filter. > > You could even create a JSON language mode, but most likely the basic C m= ode is close enough to serve that purpose. These are all good suggestions. Most languages permit trailing decimal poin= ts; the only common exceptions that I can think of are Haskell, Ada and Swi= ft. Apparently JSON is also one. Tying the float-format display to the C, P= ascal (etc) modes seems a bit incongruous as it has nothing to do with the = syntax of those languages. How to display a floating-point number with zero fraction also depends on w= hat the user wants to do with the result, so there is a good argument for l= etting him or her do the required post-processing. Sometimes '1.' should be= come '1.0', sometimes '1'. For instance, in a LaTeX document it would depen= d on how the author wants to represent significant digits. A JSON parser (s= uch as the one in Emacs) will parse '1.0' and '1' differently, as a float o= r integer respectively. I wrote the patch below as a possible solution but in the light of the abov= e, perhaps it's not ideal?