From 6d56728a759c9db12b2acd468fd2c1cdc56d7ead Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sat, 30 Jul 2005 22:45:02 +0200 Subject: re PR libfortran/22436 (print *,tiny(1._10) yields asterisks) PR libfortran/22436 * io/write.c (write_real): Add default formats for real(10) and real(16). From-SVN: r102590 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/write.c | 25 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 84bcc48..55bbfa2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2005-07-30 Francois-Xavier Coudert + + PR libfortran/22436 + * io/write.c (write_real): Add default formats for real(10) and + real(16). + 2005-07-30 Paul Thomas PR fortran/22570 and related issues. diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index a702de1..6ccf02e 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1292,7 +1292,8 @@ write_character (const char *source, int length) /* Output a real number with default format. - This is 1PG14.7E2 for REAL(4) and 1PG23.15E3 for REAL(8). */ + This is 1PG14.7E2 for REAL(4), 1PG23.15E3 for REAL(8), + 1PG24.15E4 for REAL(10) and 1PG40.31E4 for REAL(16). */ static void write_real (const char *source, int length) @@ -1301,17 +1302,31 @@ write_real (const char *source, int length) int org_scale = g.scale_factor; f.format = FMT_G; g.scale_factor = 1; - if (length < 8) + switch (length) { + case 4: f.u.real.w = 14; f.u.real.d = 7; f.u.real.e = 2; - } - else - { + break; + case 8: f.u.real.w = 23; f.u.real.d = 15; f.u.real.e = 3; + break; + case 10: + f.u.real.w = 24; + f.u.real.d = 15; + f.u.real.e = 4; + break; + case 16: + f.u.real.w = 40; + f.u.real.d = 31; + f.u.real.e = 4; + break; + default: + internal_error ("bad real kind"); + break; } write_float (&f, source , length); g.scale_factor = org_scale; -- cgit v1.1