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]

[patch,libgfortran] Simplification of calculation


This patch is s simplification of a calculation in write_float.def to give some minor speedup.

Regression tested on x86-64-linux-gnu. NIST tested.

OK for trunk?

2009-05-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR libfortran/37754
	* io/write_float.def: Simplify format calculation.

Index: write_float.def
===================================================================
--- write_float.def	(revision 147465)
+++ write_float.def	(working copy)
@@ -635,8 +635,7 @@ output_float_FMT_G_ ## x (st_parameter_d
       GFC_REAL_ ## x temp;\
       mid = (low + high) / 2;\
 \
-      temp = (calculate_exp_ ## x (mid) - \
-	      5 * calculate_exp_ ## x (mid - d - 1)) / 10;\
+      temp = calculate_exp_ ## x (mid - 1) * (1 - 1/(2 * exp_d));\
 \
       if (m < temp)\
         { \


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