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, fix] Formatted output of IEEE exceptional values


The attached patch fixes the formatting discussed in:

http://gcc.gnu.org/ml/fortran/2005-07/msg00169.html

2005-07-13 Jerry DeLisle <jvdelisle@verizon.net>

    * libfortran/write.c: Fix field width checks for printing 'Infinity'
    or 'Inf'.

Ok to commit to mainline?

Jerry
Index: write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 write.c
*** write.c	14 Jul 2005 06:21:58 -0000	1.42
--- write.c	14 Jul 2005 06:49:15 -0000
*************** write_float (fnode *f, const char *sourc
*** 788,798 ****
  	      else
  		fin = '+';
  
! 	      if (nb > 7)
  		memcpy(p + nb - 8, "Infinity", 8);
  	      else
  		memcpy(p + nb - 3, "Inf", 3);
! 	      if (nb < 8 && nb > 3)
  		p[nb - 4] = fin;
  	      else if (nb > 8)
  		p[nb - 9] = fin;
--- 788,798 ----
  	      else
  		fin = '+';
  
! 	      if (nb > 8)
  		memcpy(p + nb - 8, "Infinity", 8);
  	      else
  		memcpy(p + nb - 3, "Inf", 3);
! 	      if (nb < 9 && nb > 3)
  		p[nb - 4] = fin;
  	      else if (nb > 8)
  		p[nb - 9] = fin;

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