unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Alan Third <alan@idiocy.org>
Cc: emacs-devel@gnu.org
Subject: Re: How to use a float value with either GLYPH_DEBUG or NSTRACE
Date: Mon, 21 Aug 2017 13:51:00 -0700	[thread overview]
Message-ID: <m2wp5w4pcb.wl%esq@lawlist.com> (raw)

Thank you, Alan:

I had erroneously assumed that `%f` was only for adding/removing decimal places or rounding, rather than to show the approximate value of a `double` in this context.

I ran a few tests and am guessing that `%f` uses six (6) decimal places.  I understand that %f can be used to increase/decrease the number of decimal places.  However, this leaves me guessing exactly what the double looks like.  If the double is exactly 1.0, then it would be nice to see the same thing rather than 1.000000.  If the double is several decimal places, then I'd like to see the whole thing.

Then again, it is possible that the snippet in the opening thread is producing a double of exactly six (6) decimal places, but I do not know for sure if that is the case.

So the `%f` solution give me 99% of what I was looking for, which is certainly sufficient to handle this particular issue.  If you or anyone else have a way to print the exact value of whatever the double is (without adding/removing decimal places), an additional approach would be appreciated.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [08-21-2017 13:07:56] <21 Aug 2017 21:07:56 +0100>
FROM:  Alan Third <alan@idiocy.org>
> 
> * * *
> 
> Is it not just like printf?
> 
>     NSTRACE("float: %f", var);
> 
> -- 
> Alan Third



             reply	other threads:[~2017-08-21 20:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 20:51 Keith David Bershatsky [this message]
2017-08-21 21:30 ` How to use a float value with either GLYPH_DEBUG or NSTRACE Noam Postavsky
2017-08-21 23:55   ` Paul Eggert
  -- strict thread matches above, loose matches on Subject: below --
2017-08-22 17:04 Keith David Bershatsky
2017-08-22  4:30 Keith David Bershatsky
2017-08-22  8:23 ` Anders Lindgren
2017-08-22 11:32   ` Noam Postavsky
2017-08-22 11:51     ` Anders Lindgren
2017-08-22 15:47     ` Paul Eggert
2017-08-21 21:45 Keith David Bershatsky
2017-08-21 17:07 Keith David Bershatsky
2017-08-21 20:07 ` Alan Third

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2wp5w4pcb.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).