public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Alan Modra <amodra@gmail.com>
Cc: Nick Clifton <nickc@redhat.com>,
	Simon Marchi <simon.marchi@ericsson.com>,
	binutils@sourceware.org
Subject: Re: [PATCH] [WebAssembly] Disassembler support
Date: Mon, 10 Apr 2017 00:11:00 -0000	[thread overview]
Message-ID: <CAOqdjBdkhSK+zgm9xcVeFnHMkinjhUJkvnuTYguR4uHdRz6jNg@mail.gmail.com> (raw)
In-Reply-To: <20170409233947.GA16711@bubble.grove.modra.org>

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

On Sun, Apr 9, 2017 at 11:39 PM, Alan Modra <amodra@gmail.com> wrote:
> Yeah, I'm fine with your DECIMAL_DIG_IEEE754 patch, except to query
> whether you really want a precision of 17 for wasm_constant_f32,
> in which case forget the #define and use a hardcoded %.9g there and
> %.17g for wasm_constant_f64.  Patch to do that preapproved.


Thank you. I've attached a patch to do that (I don't have
write-after-approval privileges, so I'd be grateful if someone could
apply it).

[-- Attachment #2: binutils-wasm-010.diff --]
[-- Type: text/plain, Size: 1369 bytes --]

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 73a0071a93..1e8763e307 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-09  Pip Cet  <pipcet@gmail.com>
+
+	* wasm32-dis.c (print_insn_wasm32): Avoid DECIMAL_DIG, specify
+	appropriate floating-point precision directly.
+
 2017-04-07  Alan Modra  <amodra@gmail.com>
 
 	* ppc-opc.c (powerpc_opcodes <mviwsplt, mvidsplt, lvexbx, lvepxl,
diff --git a/opcodes/wasm32-dis.c b/opcodes/wasm32-dis.c
index 80e4ffe81a..18295d08e1 100644
--- a/opcodes/wasm32-dis.c
+++ b/opcodes/wasm32-dis.c
@@ -23,7 +23,6 @@
 #include "opintl.h"
 #include "safe-ctype.h"
 #include "floatformat.h"
-#include <float.h>
 #include "libiberty.h"
 #include "elf-bfd.h"
 #include "elf/internal.h"
@@ -405,7 +404,7 @@ print_insn_wasm32 (bfd_vma pc, struct disassemble_info *info)
           if (ret < 0)
             return -1;
           len += ret;
-          prin (stream, " %.*g", DECIMAL_DIG, fconstant);
+          prin (stream, " %.9g", fconstant);
           break;
 
         case wasm_constant_f64:
@@ -413,7 +412,7 @@ print_insn_wasm32 (bfd_vma pc, struct disassemble_info *info)
           if (ret < 0)
             return -1;
           len += ret;
-          prin (stream, " %.*g", DECIMAL_DIG, fconstant);
+          prin (stream, " %.17g", fconstant);
           break;
 
         case wasm_call:

  reply	other threads:[~2017-04-10  0:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 19:39 Simon Marchi
2017-04-07  0:00 ` Pip Cet
2017-04-07  9:32   ` Nick Clifton
2017-04-07 18:22     ` Pip Cet
2017-04-07 22:05       ` Alan Modra
2017-04-07 22:57         ` Pip Cet
2017-04-09 10:35           ` Alan Modra
2017-04-09 13:20             ` Pip Cet
2017-04-09 23:39               ` Alan Modra
2017-04-10  0:11                 ` Pip Cet [this message]
2017-04-10  5:32                   ` Alan Modra
  -- strict thread matches above, loose matches on Subject: below --
2017-03-31 23:18 Pip Cet
2017-04-06 16:22 ` Nick Clifton
2017-04-07  0:29   ` Pip Cet
2017-04-07  7:41     ` Nick Clifton

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=CAOqdjBdkhSK+zgm9xcVeFnHMkinjhUJkvnuTYguR4uHdRz6jNg@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=simon.marchi@ericsson.com \
    /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.
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).