This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[PATCH] Re: Formatted output of IEEE exceptional values
Attached patches revise library function and test case.
2005-07-19 Jerry DeLisle <jvdelisle@verizon.net>
* io/write.c (write_float): Change output for negative infinity with
field width of 3 to '***' per F95 and F2003 Standards.
OK to commit to mainline and 4.0 branch?
Regards,
Jerry
Index: write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 write.c
*** write.c 17 Jul 2005 20:28:14 -0000 1.43
--- write.c 20 Jul 2005 05:11:26 -0000
*************** write_float (fnode *f, const char *sourc
*** 784,792 ****
if (res != 0)
{
if (signbit(n))
! fin = '-';
else
! fin = '+';
if (nb > 8)
memcpy(p + nb - 8, "Infinity", 8);
--- 784,799 ----
if (res != 0)
{
if (signbit(n))
! {
! if (nb == 3)
! {
! memset (p, '*',nb);
! return;
! }
! fin = '-';
! }
else
! fin = '+';
if (nb > 8)
memcpy(p + nb - 8, "Infinity", 8);
Index: nan_inf_fmt.f90
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gfortran.fortran-torture/execute/nan_inf_fmt.f90,v
retrieving revision 1.2
diff -c -3 -p -r1.2 nan_inf_fmt.f90
*** nan_inf_fmt.f90 18 Jul 2005 00:07:53 -0000 1.2
--- nan_inf_fmt.f90 20 Jul 2005 05:10:10 -0000
***************
*** 27,33 ****
write(l,fmt=fmt)pos_inf
if (l.ne.'Inf') call abort
write(l,fmt=fmt)neg_inf
! if (l.ne.'Inf') call abort
write(l,fmt=fmt)nan
if (l.ne.'NaN') call abort
--- 27,33 ----
write(l,fmt=fmt)pos_inf
if (l.ne.'Inf') call abort
write(l,fmt=fmt)neg_inf
! if (l.ne.'***') call abort
write(l,fmt=fmt)nan
if (l.ne.'NaN') call abort