all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dave Gillespie <Daveg@synaptics.com>
To: "Jelle Licht" <jlicht@fsfe.org>,
	"Mattias Engdegård" <mattiase@acm.org>,
	"Stefan Kangas" <stefan@marxist.se>
Cc: "47302@debbugs.gnu.org" <47302@debbugs.gnu.org>
Subject: bug#47302: 27.1; calc math-format-number formatting for floats without decimals is unusual
Date: Thu, 22 Apr 2021 16:35:25 +0000	[thread overview]
Message-ID: <BYAPR03MB359209709A97DBB74B10C1C3BC469@BYAPR03MB3592.namprd03.prod.outlook.com> (raw)
In-Reply-To: <86v98ejr8x.fsf@fsfe.org>

Wow, it has been a long time since I got any correspondence on Calc!

Yes, I used the notation "123." versus "123.0" with the goal to keep the output concise for casual interactive users.  I agree with Mattias that it is best to leave the default as it is.

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 format 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 text transformation using calc-language-filter.

You could even create a JSON language mode, but most likely the basic C mode is close enough to serve that purpose.

Thanks!

                                                                -- Dave



-----Original Message-----
From: Jelle Licht <jlicht@fsfe.org> 
Sent: Thursday, April 22, 2021 8:04 AM
To: Mattias Engdegård <mattiase@acm.org>; Stefan Kangas <stefan@marxist.se>
Cc: 47302@debbugs.gnu.org; Dave Gillespie <Daveg@synaptics.com>
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 attachments unless you recognize the sender and know the content is safe.


Mattias Engdegård <mattiase@acm.org> writes:

> 21 apr. 2021 kl. 17.16 skrev Stefan Kangas <stefan@marxist.se>:
>>
>> Jelle Licht <jlicht@fsfe.org> writes:
>
>>> (calc-eval "123.0") ; => "123."
>>> (calc-eval "0.0") ; => "0."
>>>
>>> I would expect this output to be either "123.0" or "123" and "0.0" or
>>> "0" respectively.
>
> Jelle, thanks for the report!
>
> Calc distinguishes integers from floating-point numbers by the presence of a decimal point, so removing it is probably not a good idea. The lack of a trailing 0 after the decimal point is clearly intended but mainly a cosmetic issue; it's uncommon in hand-writing but not in computerese.
>
> We could put a 0 after the decimal point but not doing so saves some space in the often narrow Calc windows. I'd suggest leaving it as it is. The notation is distinctive enough that there is no serious risk of misunderstanding.
>
> If you disagree, do say.
Hi Mattias,

It would be nice to have a (formatting) option to print 'full'
floating-point numbers. There are a lot of other knobs to tweak
w.r.t. printing numbers, so in that sense it does not seem totally
inconceivable for such a thing to exist.

The context in which I would use this is one where the output of calc is
being used by other programs and data formats (e.g. JSON). For now, I'll
just have to have emacs read and then subsequently print the result of
my calc-adventures, which works fine.

Thanks for the consideration,
 - Jelle

  reply	other threads:[~2021-04-22 16:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 21:54 bug#47302: 27.1; calc math-format-number formatting for floats without decimals is unusual Jelle Licht
2021-04-21 15:16 ` Stefan Kangas
2021-04-22 13:44   ` Mattias Engdegård
2021-04-22 15:03     ` Jelle Licht
2021-04-22 16:35       ` Dave Gillespie [this message]
2021-04-25 15:53         ` Mattias Engdegård
2021-04-26 14:58           ` Dave Gillespie
2021-04-27 16:15             ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR03MB359209709A97DBB74B10C1C3BC469@BYAPR03MB3592.namprd03.prod.outlook.com \
    --to=daveg@synaptics.com \
    --cc=47302@debbugs.gnu.org \
    --cc=jlicht@fsfe.org \
    --cc=mattiase@acm.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.