This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Change floating point precision


The Go spec calls for the precision of untyped floating point constants
to use 256 bits, but gccgo was only using 128 bits.  This patch fixes
that.  This required adjusting one of the tests so that a floating point
expression remains an integer as required.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2012-04-23  Ian Lance Taylor  <iant@google.com>

	* go-lang.c (go_langhook_init): Set MPFR precision to 256.



Index: gcc/go/go-lang.c
===================================================================
--- gcc/go/go-lang.c	(revision 186643)
+++ gcc/go/go-lang.c	(working copy)
@@ -103,7 +103,7 @@ go_langhook_init (void)
   /* The default precision for floating point numbers.  This is used
      for floating point constants with abstract type.  This may
      eventually be controllable by a command line option.  */
-  mpfr_set_default_prec (128);
+  mpfr_set_default_prec (256);
 
   /* Go uses exceptions.  */
   using_eh_for_cleanups ();
Index: libgo/go/time/time_test.go
===================================================================
--- libgo/go/time/time_test.go	(revision 186643)
+++ libgo/go/time/time_test.go	(working copy)
@@ -804,7 +804,7 @@ var jsonTests = []struct {
 	time Time
 	json string
 }{
-	{Date(9999, 4, 12, 23, 20, 50, .52*1e9, UTC), `"9999-04-12T23:20:50.52Z"`},
+	{Date(9999, 4, 12, 23, 20, 50, 520*1e6, UTC), `"9999-04-12T23:20:50.52Z"`},
 	{Date(1996, 12, 19, 16, 39, 57, 0, Local), `"1996-12-19T16:39:57-08:00"`},
 	{Date(0, 1, 1, 0, 0, 0, 1, FixedZone("", 1*60)), `"0000-01-01T00:00:00.000000001+00:01"`},
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]