From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.devel Subject: Re: How to use a float value with either GLYPH_DEBUG or NSTRACE Date: Tue, 22 Aug 2017 07:32:38 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1503401925 23169 195.159.176.226 (22 Aug 2017 11:38:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 22 Aug 2017 11:38:45 +0000 (UTC) Cc: Alan Third , Keith David Bershatsky , emacs-devel , Paul Eggert To: Anders Lindgren Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 22 13:38:36 2017 Return-path: Envelope-to: ged-emacs-devel@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 1dk7Vs-00057m-LE for ged-emacs-devel@m.gmane.org; Tue, 22 Aug 2017 13:38:28 +0200 Original-Received: from localhost ([::1]:37095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dk7Vu-0007Mj-Lb for ged-emacs-devel@m.gmane.org; Tue, 22 Aug 2017 07:38:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dk7QH-0003YP-0v for emacs-devel@gnu.org; Tue, 22 Aug 2017 07:32:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dk7QG-0003cm-3e for emacs-devel@gnu.org; Tue, 22 Aug 2017 07:32:41 -0400 Original-Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:34686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dk7QF-0003cC-VU for emacs-devel@gnu.org; Tue, 22 Aug 2017 07:32:40 -0400 Original-Received: by mail-oi0-x230.google.com with SMTP id j144so54610777oib.1 for ; Tue, 22 Aug 2017 04:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=5bn0KstPnqfMgwWgg4ZqgAeQ8NmTbSEUlhXEdiC/EUU=; b=HJl8P4zs96BD6wWKk9uQ12MNCosvohtYZPAbx7zOfgyvKt1JyVUPhWNlNEyvSwSXNl S7SdlPTRDjYcgwAQUdPQrEwKKehdu34YC2HrjXRQaFKmPyChvpqWqpyVrJk26VfnlABs G1AxTkt7H2KcRNbvvVoJ3EZr/86GJE+ftlzNmYMT6K2Me6U7kJvZ/v6nvM/UoY/tY4fw 8rZDEAGGa2Lo4FW6h071YVjQduRNhWIpdh6N5O6++ZHqkZx8SwWS3JzaVd5wMxrY8FHm zn/NPja6NYw76M42KbeQ76ht4/tSks3W9wfI7KD/nSrdXEcbdZ/C+hIfdlO1nJ0+NRCy vDnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=5bn0KstPnqfMgwWgg4ZqgAeQ8NmTbSEUlhXEdiC/EUU=; b=rfPmjWTt1rtsZuuSDOfoUpSw0CB1ZbvgxS32OVF2RN8OJn9xAnyW6xlzq/AZKqE9y/ s4k3+N/0fpafmYT1lTlZ8az7MHcHcTlvKaPTjOdu57clKeI+nZXfUy0aU3gqhPUNA1Oy 5LhwXAssPPZIgVCN6iiQJKz/QS0PQnurL8GnG5cQu8NtmwJc4PgH124N78e4pHnlQyK/ HP0Ryxg3ZluGHNd8WGUPFN0gSDzWFdmzctUjka46Hsjfs6aKBGdtrWBqfQA0snp4xHnk 9NDgRJ6+STL9fNqpy3BQUGpyVzz9z/bqjOrU8K12QJC6Rr3BwNadLGWYNycGETIRc0Q7 qURg== X-Gm-Message-State: AHYfb5h2HxMVNvz6EAeTnMVBfaXy/pAlU8qi9btZUqetKj1GVQkyurj9 06zmuM35vB8Qy5A4GYOG2qC6ISLlqQ== X-Received: by 10.202.73.151 with SMTP id w145mr466756oia.274.1503401559241; Tue, 22 Aug 2017 04:32:39 -0700 (PDT) Original-Received: by 10.74.18.129 with HTTP; Tue, 22 Aug 2017 04:32:38 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: yBpSNV4L-b4CaQ8yX8i2M9bZRco X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217680 Archived-At: On Tue, Aug 22, 2017 at 4:23 AM, Anders Lindgren wrote: > I think(*) you can use "%a" to print the hexadecimal representation of a > floating point number. This prints the floating point number exactly, down > to the last bit in the mantissa. It looks like 0x0.3p10, where 0x0.3 is the > "significant" part and "p10" the binary exponent, and it represents the > number 0x0.3 * 2^10. I think this is GNU libc specific, also not as readable for humans. > On Tue, Aug 22, 2017 at 6:30 AM, Keith David Bershatsky > wrote: >> >> Thank you, Paul, for the suggestion to use dtoastr. I tried that and a >> few variations, but got stuck because dtoastr returns an `int` and `%s` >> expects a `char` value. Substituting `%s` for `%d` did not yield the >> correct results. dtoastr returns the length of the string like *printf, so you would have to use it like this: void example (CGFloat value) { char buf[DBL_BUFSIZE_BOUND]; dtoastr (buf, sizeof buf, 0, 0, value) NSTRACE ("float: %s", buf); }