Index: binutils-gdb/gdb/i387-tdep.c
===================================================================
--- binutils-gdb.orig/gdb/i387-tdep.c
+++ binutils-gdb/gdb/i387-tdep.c
@@ -18,7 +18,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "doublest.h"
 #include "frame.h"
 #include "gdbcore.h"
 #include "inferior.h"
@@ -30,31 +29,6 @@
 #include "i387-tdep.h"
 #include "x86-xstate.h"
 
-/* Print the floating point number specified by RAW.  */
-
-static void
-print_i387_value (struct gdbarch *gdbarch,
-		  const gdb_byte *raw, struct ui_file *file)
-{
-  DOUBLEST value;
-
-  /* Using extract_typed_floating here might affect the representation
-     of certain numbers such as NaNs, even if GDB is running natively.
-     This is fine since our caller already detects such special
-     numbers and we print the hexadecimal representation anyway.  */
-  value = extract_typed_floating (raw, i387_ext_type (gdbarch));
-
-  /* We try to print 19 digits.  The last digit may or may not contain
-     garbage, but we'd better print one too many.  We need enough room
-     to print the value, 1 position for the sign, 1 for the decimal
-     point, 19 for the digits and 6 for the exponent adds up to 27.  */
-#ifdef PRINTF_HAS_LONG_DOUBLE
-  fprintf_filtered (file, " %-+27.19Lg", (long double) value);
-#else
-  fprintf_filtered (file, " %-+27.19g", (double) value);
-#endif
-}
-
 /* Print the classification for the register contents RAW.  */
 
 static void
@@ -89,12 +63,16 @@ print_i387_ext (struct gdbarch *gdbarch,
 	fputs_filtered (" SNaN", file);
     }
   else if (exponent < 0x7fff && exponent > 0x0000 && integer)
-    /* Normal.  */
-    print_i387_value (gdbarch, raw, file);
+    {
+      /* Normal.  */
+      fputs_filtered (" ", file);
+      print_floating (raw, i387_ext_type (gdbarch), file);
+    }
   else if (exponent == 0x0000)
     {
       /* Denormal or zero.  */
-      print_i387_value (gdbarch, raw, file);
+      fputs_filtered (" ", file);
+      print_floating (raw, i387_ext_type (gdbarch), file);
       
       if (integer)
 	/* Pseudo-denormal.  */
Index: binutils-gdb/gdb/testsuite/gdb.arch/i386-float.exp
===================================================================
--- binutils-gdb.orig/gdb/testsuite/gdb.arch/i386-float.exp
+++ binutils-gdb/gdb/testsuite/gdb.arch/i386-float.exp
@@ -47,9 +47,9 @@ with_test_prefix "val" {
 }
 with_test_prefix "smallval" {
     gdb_test "stepi" ".*fldt.*"
-    gdb_test "info float" "=>R6: Valid   0x03e5c6f8c103dc90456a \\+3.500000000000000007e-4632\r\n.*"
+    gdb_test "info float" "=>R6: Valid   0x03e5c6f8c103dc90456a 3.50000000000000000\[0-9\]*e-4632\r\n.*"
 }
 with_test_prefix "bigval" {
     gdb_test "stepi" ".*ret.*"
-    gdb_test "info float" "=>R5: Valid   0x6a5cc643b78165d7d0e9 \\+7.250000000000000005e\\+3264\r\n.*"
+    gdb_test "info float" "=>R5: Valid   0x6a5cc643b78165d7d0e9 7.25000000000000000\[0-9\]*e\\+3264\r\n.*"
 }
Index: binutils-gdb/gdb/mips-tdep.c
===================================================================
--- binutils-gdb.orig/gdb/mips-tdep.c
+++ binutils-gdb/gdb/mips-tdep.c
@@ -6256,8 +6256,6 @@ mips_print_fp_register (struct ui_file *
 {				/* Do values for FP (float) regs.  */
   struct gdbarch *gdbarch = get_frame_arch (frame);
   gdb_byte *raw_buffer;
-  double doub, flt1;	/* Doubles extracted from raw hex data.  */
-  int inv1, inv2;
 
   raw_buffer
     = ((gdb_byte *)
@@ -6275,8 +6273,6 @@ mips_print_fp_register (struct ui_file *
       /* 4-byte registers: Print hex and floating.  Also print even
          numbered registers as doubles.  */
       mips_read_fp_register_single (frame, regnum, raw_buffer);
-      flt1 = unpack_double (builtin_type (gdbarch)->builtin_float,
-			    raw_buffer, &inv1);
 
       get_formatted_print_options (&opts, 'x');
       print_scalar_formatted (raw_buffer,
@@ -6284,22 +6280,16 @@ mips_print_fp_register (struct ui_file *
 			      &opts, 'w', file);
 
       fprintf_filtered (file, " flt: ");
-      if (inv1)
-	fprintf_filtered (file, " <invalid float> ");
-      else
-	fprintf_filtered (file, "%-17.9g", flt1);
+      print_floating (raw_buffer,
+                      builtin_type (gdbarch)->builtin_float, file);
 
       if ((regnum - gdbarch_num_regs (gdbarch)) % 2 == 0)
 	{
 	  mips_read_fp_register_double (frame, regnum, raw_buffer);
-	  doub = unpack_double (builtin_type (gdbarch)->builtin_double,
-				raw_buffer, &inv2);
 
 	  fprintf_filtered (file, " dbl: ");
-	  if (inv2)
-	    fprintf_filtered (file, "<invalid double>");
-	  else
-	    fprintf_filtered (file, "%-24.17g", doub);
+          print_floating (raw_buffer,
+                          builtin_type (gdbarch)->builtin_double, file);
 	}
     }
   else
@@ -6307,30 +6297,24 @@ mips_print_fp_register (struct ui_file *
       struct value_print_options opts;
 
       /* Eight byte registers: print each one as hex, float and double.  */
-      mips_read_fp_register_single (frame, regnum, raw_buffer);
-      flt1 = unpack_double (builtin_type (gdbarch)->builtin_float,
-			    raw_buffer, &inv1);
-
       mips_read_fp_register_double (frame, regnum, raw_buffer);
-      doub = unpack_double (builtin_type (gdbarch)->builtin_double,
-			    raw_buffer, &inv2);
 
       get_formatted_print_options (&opts, 'x');
       print_scalar_formatted (raw_buffer,
 			      builtin_type (gdbarch)->builtin_uint64,
 			      &opts, 'g', file);
 
+      mips_read_fp_register_single (frame, regnum, raw_buffer);
+
       fprintf_filtered (file, " flt: ");
-      if (inv1)
-	fprintf_filtered (file, "<invalid float>");
-      else
-	fprintf_filtered (file, "%-17.9g", flt1);
+      print_floating (raw_buffer,
+                      builtin_type (gdbarch)->builtin_float, file);
+
+      mips_read_fp_register_double (frame, regnum, raw_buffer);
 
       fprintf_filtered (file, " dbl: ");
-      if (inv2)
-	fprintf_filtered (file, "<invalid double>");
-      else
-	fprintf_filtered (file, "%-24.17g", doub);
+      print_floating (raw_buffer,
+                      builtin_type (gdbarch)->builtin_double, file);
     }
 }
 
Index: binutils-gdb/gdb/sh64-tdep.c
===================================================================
--- binutils-gdb.orig/gdb/sh64-tdep.c
+++ binutils-gdb/gdb/sh64-tdep.c
@@ -1915,8 +1915,6 @@ sh64_do_fp_register (struct gdbarch *gdb
 		     struct frame_info *frame, int regnum)
 {				/* Do values for FP (float) regs.  */
   unsigned char *raw_buffer;
-  double flt;	/* Double extracted from raw hex data.  */
-  int inv;
 
   /* Allocate space for the float.  */
   raw_buffer = (unsigned char *)
@@ -1927,20 +1925,13 @@ sh64_do_fp_register (struct gdbarch *gdb
     error (_("can't read register %d (%s)"),
 	   regnum, gdbarch_register_name (gdbarch, regnum));
 
-  /* Get the register as a number.  */ 
-  flt = unpack_double (builtin_type (gdbarch)->builtin_float,
-		       raw_buffer, &inv);
-
   /* Print the name and some spaces.  */
   fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
   print_spaces_filtered (15 - strlen (gdbarch_register_name
 					(gdbarch, regnum)), file);
 
   /* Print the value.  */
-  if (inv)
-    fprintf_filtered (file, "<invalid float>");
-  else
-    fprintf_filtered (file, "%-10.9g", flt);
+  print_floating (raw_buffer, builtin_type (gdbarch)->builtin_float, file);
 
   /* Print the fp register as hex.  */
   fprintf_filtered (file, "\t(raw ");
