gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 39c85536: Table: set format and precision of f


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 39c85536: Table: set format and precision of float cols in plain-text outputs
Date: Tue, 18 Oct 2022 21:58:08 -0400 (EDT)

branch: master
commit 39c8553679bd28e1947d3659ac05db81a83c1e78
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Table: set format and precision of float cols in plain-text outputs
    
    Until now, Table didn't have a feature to customize the format or precision
    (number of digits after the decimal point) of floating point columns in
    plain-text outputs. Furthermore the default printing mode was with the '%g'
    format which can have different precisions for different print-widths and
    will cause problems in science contexts.
    
    With this commit, four new options have been added to table for customizing
    how it prints floating points in plain-text outputs. During the process,
    the following minor modifications have also been done in the library:
    
     - GAL_TABLE_DISPLAY_FMT_FIXED: new name for GAL_TABLE_DISPLAY_FMT_FLOAT
       since it corresponds to the fixed-point notation of printing floating
       points in plain-text (the '_FLOAT' suffix was too generic and unclear).
    
     - For plain-text outputs, the final column of each line will not have any
       trailing white space. This will help save space in plain-text outputs
       with many rows, and also automatically allows for the single-valued
       outputs to be easily passed to a shell variable (and thus not needing
       special attention in 'gal_txt_write').
    
     - For ASCII FITS tables, we can't have too much precision since the width
       must be fixed. Until now, we were just using the floating point
       precision, but that wasn't robust: for a sufficiently large number, this
       could exceed the width and exceeding the width causes a CFITSIO crash
       (which was very painful to discover!). So we now adjust the precision in
       ASCII FITS tables to fit within the desired width.
---
 NEWS                    | 23 +++++++++++++--
 bin/mkcatalog/columns.c | 78 ++++++++++++++++++++++++-------------------------
 bin/table/args.h        | 52 +++++++++++++++++++++++++++++++++
 bin/table/asttable.conf | 12 ++++++--
 bin/table/main.h        |  6 ++++
 bin/table/table.c       | 25 ++++++++++++++++
 bin/table/ui.c          | 18 ++++++++++++
 bin/table/ui.h          |  8 +++--
 doc/gnuastro.texi       | 44 +++++++++++++++++++++++++++-
 lib/fits.c              |  2 +-
 lib/gnuastro/table.h    | 17 +++++++++--
 lib/table.c             | 43 +++++++++++++++++++++++++++
 lib/tableintern.c       | 48 ++++++++++++++++++------------
 lib/txt.c               | 61 +++++++++++++++++---------------------
 14 files changed, 334 insertions(+), 103 deletions(-)

diff --git a/NEWS b/NEWS
index 7f3b16a1..d00c9fa7 100644
--- a/NEWS
+++ b/NEWS
@@ -29,8 +29,8 @@ See the end of the file for license conditions.
     - fine-structure: Fine structure constant (no units).
     - counts-to-sb: convert counts to surface brightness (mag/arcsec^2).
     - sb-to-counts: convert surface brightness (mag/arcsec^2) to counts.
-    - mag-to-sb: convert magnitudes to surface brightness over a certain area.
-    - sb-to-mag: convert surface brightness to magnitudes over a certain area.
+    - mag-to-sb: convert magnitudes to surface brightness over an area.
+    - sb-to-mag: convert surface brightness to magnitudes over an area.
   - New operators that are specific to Arithmetic:
     - collapse-median: collapse input dataset by calculating the median
       along the given dimension.
@@ -111,6 +111,22 @@ See the end of the file for license conditions.
     --fitestimatehdu: HDU containing table in file given to '--fitestimate'.
     --fitestimatecol: Column containing X axis values for '--fitestimate'.
 
+  Table:
+  - It is now possible to customize the format of floating point numbers in
+    the plain-text outputs: when output is printed on the standard output
+    (command-line) or in plain-text files. The following new options have
+    been added for this new feature:
+    --txtf32format (or '-f'): Format of 32-bit floating point columns. This
+      can be either 'fixed' (for fixed-point notation) or 'exp' (for
+      exponential/scientific notation).
+    --txtf32precision (or '-d'): number of digits following the
+      decimal-point of 32-bit floating point columns.
+    --txtf64format (or '-p'): Format of 64-bit floating point columns. This
+      can be either 'fixed' (for fixed-point notation) or 'exp' (for
+      exponential/scientific notation).
+    --txtf32precision (or '-B'): number of digits following the
+      decimal-point of 32-bit floating point columns.
+
   Warp:
   - Can correct distortions (with any standard recognized by WCSLIB) and
     simultaneously align the image to the coordinate system. When no named
@@ -267,6 +283,9 @@ See the end of the file for license conditions.
   - gal_pdf_write: similar to 'gal_eps_write'.
   - gal_fits_hdu_open: new argument to optionally exit program if HDU
         couldn't be opened.
+  - GAL_TABLE_DISPLAY_FMT_FIXED: new name for GAL_TABLE_DISPLAY_FMT_FLOAT
+    since it corresponds to the fixed-point notation of printing floating
+    points in plain-text (the '_FLOAT' suffix was too generic and unclear).
 
 ** Bugs fixed
   bug #62861: '--printkeynames' of Fits program gets caught in an infinite
diff --git a/bin/mkcatalog/columns.c b/bin/mkcatalog/columns.c
index 8c0c9ec9..78ba8596 100644
--- a/bin/mkcatalog/columns.c
+++ b/bin/mkcatalog/columns.c
@@ -578,7 +578,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_VX     ] = ciflag[ CCOL_VX     ] = 1;
@@ -594,7 +594,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_VY     ] = ciflag[ CCOL_VY     ] = 1;
@@ -610,7 +610,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_VZ ] = 1;
@@ -624,7 +624,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_GX     ] = ciflag[ CCOL_GX     ] = 1;
@@ -638,7 +638,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_GY     ] = ciflag[ CCOL_GY     ] = 1;
@@ -652,7 +652,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_GZ ] = 1;
@@ -666,7 +666,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_C_VX     ] = 1;
@@ -682,7 +682,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_C_VY     ] = 1;
@@ -698,7 +698,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_C_VZ ] = 1;
@@ -711,7 +711,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_C_GX     ] = 1;
@@ -725,7 +725,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_C_GY     ] = 1;
@@ -739,7 +739,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_C_GZ ] = 1;
@@ -945,7 +945,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_FLOAT64;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_radec(p);
@@ -969,7 +969,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_FLOAT64;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_radec(p);
@@ -993,7 +993,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_FLOAT64;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_radec(p);
@@ -1014,7 +1014,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_FLOAT64;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_georadec(p);
@@ -1032,7 +1032,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_FLOAT64;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_georadec(p);
@@ -1050,7 +1050,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_FLOAT64;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_georadec(p);
@@ -1067,7 +1067,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_clumpsradec(p);
@@ -1091,7 +1091,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 15;
           disp_precision = 7;
           columns_alloc_clumpsradec(p);
@@ -1115,7 +1115,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 15;
           disp_precision = 7;
           columns_alloc_clumpsradec(p);
@@ -1139,7 +1139,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_clumpsgeoradec(p);
@@ -1157,7 +1157,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_clumpsgeoradec(p);
@@ -1175,7 +1175,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT64;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 13;
           disp_precision = 7;
           columns_alloc_clumpsgeoradec(p);
@@ -1378,7 +1378,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 8;
           disp_precision = 3;
           p->hasmag      = 1;
@@ -1397,7 +1397,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 8;
           disp_precision = 3;
           oiflag[ OCOL_NUM         ] = ciflag[ CCOL_NUM         ] = 1;
@@ -1414,7 +1414,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = NULL;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_INVALID;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 8;
           disp_precision = 3;
           p->hasmag      = 1;
@@ -1443,7 +1443,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 8;
           disp_precision = 3;
           p->hasmag      = 1;
@@ -1458,7 +1458,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 8;
           disp_precision = 3;
           p->hasmag      = 1;
@@ -1521,7 +1521,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 8;
           disp_precision = 3;
           p->upperlimit  = 1;
@@ -1561,7 +1561,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_NUM         ] = ciflag[ CCOL_NUM         ] = 1;
@@ -1609,7 +1609,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_SUMWHT ] = ciflag[ CCOL_SUMWHT ] = 1;
@@ -1633,7 +1633,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_SUMWHT ] = ciflag[ CCOL_SUMWHT ] = 1;
@@ -1657,7 +1657,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 7;
           disp_precision = 3;
           oiflag[ OCOL_SUMWHT ] = ciflag[ CCOL_SUMWHT ] = 1;
@@ -1681,7 +1681,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_SUMWHT ] = ciflag[ CCOL_SUMWHT ] = 1;
@@ -1705,7 +1705,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_NUMALL ] = ciflag[ CCOL_NUMALL ] = 1;
@@ -1723,7 +1723,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_NUMALL ] = ciflag[ CCOL_NUMALL ] = 1;
@@ -1741,7 +1741,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 7;
           disp_precision = 3;
           oiflag[ OCOL_NUMALL ] = ciflag[ CCOL_NUMALL ] = 1;
@@ -1759,7 +1759,7 @@ columns_define_alloc(struct mkcatalogparams *p)
           ccomment       = ocomment;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
-          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FLOAT;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_FIXED;
           disp_width     = 10;
           disp_precision = 3;
           oiflag[ OCOL_NUMALL ] = ciflag[ CCOL_NUMALL ] = 1;
diff --git a/bin/table/args.h b/bin/table/args.h
index 502f0a8e..ea7e4709 100644
--- a/bin/table/args.h
+++ b/bin/table/args.h
@@ -194,6 +194,58 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET,
       gal_options_parse_name_and_strings
     },
+    {
+      "txtf32format",
+      UI_KEY_TXTF32FORMAT,
+      "STR",
+      0,
+      "Text output float32 format: 'fixed' or 'exp'.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->txtf32fmtstr,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
+      "txtf64format",
+      UI_KEY_TXTF64FORMAT,
+      "STR",
+      0,
+      "Text output float64 format: 'fixed' or 'exp'.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->txtf64fmtstr,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
+      "txtf32precision",
+      UI_KEY_TXTF32PRECISION,
+      "INT",
+      0,
+      "Text output float32 precision.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->txtf32precision,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GE_0,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
+      "txtf64precision",
+      UI_KEY_TXTF64PRECISION,
+      "INT",
+      0,
+      "Text output float32 precision.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->txtf64precision,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GE_0,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
 
 
 
diff --git a/bin/table/asttable.conf b/bin/table/asttable.conf
index e00deb0e..cd90523a 100644
--- a/bin/table/asttable.conf
+++ b/bin/table/asttable.conf
@@ -20,6 +20,12 @@
 # warranty.
 
 # Inputs
- wcshdu        1
- catrowhdu     1
- catcolumnhdu  1
+ wcshdu              1
+ catrowhdu           1
+ catcolumnhdu        1
+
+# Options
+ txtf32format        fixed
+ txtf32precision     6
+ txtf64format        fixed
+ txtf64precision     12
diff --git a/bin/table/main.h b/bin/table/main.h
index 73578e51..f7e0def8 100644
--- a/bin/table/main.h
+++ b/bin/table/main.h
@@ -122,6 +122,10 @@ struct tableparams
   gal_list_str_t  *catrowfile;  /* Filename to concat column wise.      */
   gal_list_str_t   *catrowhdu;  /* HDU/extension for the catcolumn.     */
   gal_data_t     *colmetadata;  /* Set column metadata.                 */
+  char          *txtf32fmtstr;  /* Floating point formats (exp, flt).   */
+  char          *txtf64fmtstr;  /* Floating point formats (exp, flt).   */
+  size_t      txtf32precision;  /* Precision of float32 in text.        */
+  size_t      txtf64precision;  /* Precision of float32 in text.        */
 
   /* Internal. */
   struct column_pack *outcols;  /* Output column packages.              */
@@ -144,6 +148,8 @@ struct tableparams
   const char        *rng_name;  /* Name of random number generator.     */
   unsigned long int  rng_seed;  /* Random number generator seed.        */
   size_t            *colmatch;  /* Number of matches found for columns. */
+  uint8_t        txtf32format;  /* Floating point formats (exp, flt).   */
+  uint8_t        txtf64format;  /* Floating point formats (exp, flt).   */
 
   /* For arithmetic operators. */
   gal_list_str_t  *wcstoimg_p;  /* Pointer to the node.                 */
diff --git a/bin/table/table.c b/bin/table/table.c
index 77593db4..c109f023 100644
--- a/bin/table/table.c
+++ b/bin/table/table.c
@@ -1190,6 +1190,30 @@ table_noblankend(struct tableparams *p)
 
 
 
+static void
+table_txt_formats(struct tableparams *p)
+{
+  gal_data_t *tmp;
+
+  for(tmp=p->table; tmp!=NULL; tmp=tmp->next)
+    {
+      switch(tmp->type)
+        {
+        case GAL_TYPE_FLOAT32:
+          if(p->txtf32format)    tmp->disp_fmt=p->txtf32format;
+          if(p->txtf32precision) tmp->disp_precision=p->txtf32precision;
+          break;
+        case GAL_TYPE_FLOAT64:
+          if(p->txtf64format)    tmp->disp_fmt=p->txtf64format;
+          if(p->txtf64precision) tmp->disp_precision=p->txtf64precision;
+          break;
+        }
+    }
+}
+
+
+
+
 
 
 
@@ -1239,6 +1263,7 @@ table(struct tableparams *p)
   if(p->noblankend) table_noblankend(p);
 
   /* Write the output. */
+  table_txt_formats(p);
   gal_table_write(p->table, NULL, NULL, p->cp.tableformat, p->cp.output,
                   "TABLE", p->colinfoinstdout);
 }
diff --git a/bin/table/ui.c b/bin/table/ui.c
index eea2f363..0606c5a5 100644
--- a/bin/table/ui.c
+++ b/bin/table/ui.c
@@ -341,6 +341,24 @@ ui_read_check_only_options(struct tableparams *p)
           "because '--catcolumnfile' (or '-L') was not given to specify "
           "which file the new columns should come from. To suppress this "
           "warning, please run with '--quiet'");
+
+  /* Check the floating point format string. */
+  if(p->txtf32fmtstr)
+    {
+      p->txtf32format=gal_table_displayflt_from_str(p->txtf32fmtstr);
+      if(p->txtf32format==GAL_TABLE_DISPLAY_FMT_INVALID)
+        error(EXIT_FAILURE, 0, "'%s' is not a recognized value for "
+              "'--txtf64format'. Recognized values are 'fixed' and "
+              "'exp'", p->txtf32fmtstr);
+    }
+  if(p->txtf64fmtstr)
+    {
+      p->txtf64format=gal_table_displayflt_from_str(p->txtf64fmtstr);
+      if(p->txtf64format==GAL_TABLE_DISPLAY_FMT_INVALID)
+        error(EXIT_FAILURE, 0, "'%s' is not a recognized value for "
+              "'--txtf64format'. Recognized values are 'fixed' and "
+              "'exp'", p->txtf64fmtstr);
+    }
 }
 
 
diff --git a/bin/table/ui.h b/bin/table/ui.h
index b1cd6ced..9869f027 100644
--- a/bin/table/ui.h
+++ b/bin/table/ui.h
@@ -41,8 +41,8 @@ enum program_args_groups
 
 /* Available letters for short options:
 
-   a d f g j k l p t v x y z
-   A B G J O Q Y
+   a g j k l t v x y z
+   A G J Q Y
 */
 enum option_keys_enum
 {
@@ -67,6 +67,10 @@ enum option_keys_enum
   UI_KEY_CATROWFILE      = 'R',
   UI_KEY_CATROWHDU       = 'X',
   UI_KEY_COLMETADATA     = 'm',
+  UI_KEY_TXTF32FORMAT    = 'f',
+  UI_KEY_TXTF64FORMAT    = 'd',
+  UI_KEY_TXTF32PRECISION = 'p',
+  UI_KEY_TXTF64PRECISION = 'B',
 
   /* Only with long version (start with a value 1000, the rest will be set
      automatically). */
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 51a85e60..d64aca46 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -14407,6 +14407,7 @@ If any output file is explicitly requested (with 
@option{--output}) the output t
 When no output file is explicitly requested the output table will be written 
to the standard output.
 If the specified output is a FITS file, the type of FITS table (binary or 
ASCII) will be determined from the @option{--tabletype} option.
 If the output is not a FITS file, it will be printed as a plain text table 
(with space characters between the columns).
+When the output is not binary (for example standard output or a plain-text), 
the @option{--txtf32*} or @option{--txtf64*} options can be used for the 
formatting of floating point columns.
 When the columns are accompanied by meta-data (like column name, units, or 
comments), this information will also printed in the plain text file before the 
table, as described in @ref{Gnuastro text table format}.
 
 For the full list of options common to all Gnuastro programs please see 
@ref{Common options}.
@@ -14811,6 +14812,39 @@ Recall that when a name is given, this option will 
update the metadata of the fi
 
 Finally, if you already have a FITS table by other means (for example, by 
downloading) and you merely want to update the column metadata and leave the 
data intact, it is much more efficient to directly modify the respective FITS 
header keywords with @code{astfits}, using the keyword manipulation features 
described in @ref{Keyword inspection and manipulation}.
 @option{--colmetadata} is mainly intended for scenarios where you want to edit 
the data so it will always load the full/partial dataset into memory, then 
write out the resulting datasets with updated/corrected metadata.
+
+
+@item  -f STR
+@itemx --txtf32format=STR
+The plain-text format of 32-bit floating point columns when output is not 
binary (this option is ignored for binary outputs like FITS tables).
+The acceptable values are listed below.
+This is just the format of the plain-text outputs; see 
@option{--txtf32precision} for customizing their precision.
+@table @code
+@item fixed
+Fixed-point notation (for example @code{1234567.89012})
+@item exp
+Exponential notation (for example @code{1.2345689012e+06})
+@end table
+
+@item  -p STR
+@itemx --txtf32precision=INT
+Number of digits after the decimal point (precision) for columns with a 32-bit 
floating point datatype.
+
+@item  -d STR
+@itemx --txtf64format=STR
+The plain-text format of 64-bit floating point columns when output is not 
binary (this option is ignored for binary outputs like FITS tables).
+The acceptable values are listed below.
+This is just the format of the plain-text outputs; see 
@option{--txtf64precision} for customizing their precision.
+@table @code
+@item fixed
+Fixed-point notation (for example @code{1234567.89012})
+@item exp
+Exponential notation (for example @code{1.2345689012e+06})
+@end table
+
+@item  -B STR
+@itemx --txtf64precision=INT
+Number of digits after the decimal point (precision) for columns with a 64-bit 
floating point datatype.
 @end table
 
 
@@ -32258,7 +32292,7 @@ directly used in C's @code{printf} command to write the 
number as a string.
 @deffnx Macro GAL_TABLE_DISPLAY_FMT_UDECIMAL
 @deffnx Macro GAL_TABLE_DISPLAY_FMT_OCTAL
 @deffnx Macro GAL_TABLE_DISPLAY_FMT_HEX
-@deffnx Macro GAL_TABLE_DISPLAY_FMT_FLOAT
+@deffnx Macro GAL_TABLE_DISPLAY_FMT_FIXED
 @deffnx Macro GAL_TABLE_DISPLAY_FMT_EXP
 @deffnx Macro GAL_TABLE_DISPLAY_FMT_GENERAL
 The display format used in C's @code{printf} to display data of different
@@ -32302,6 +32336,14 @@ string to match, or regular expression to search, be 
in the @emph{name},
 should be used for the @code{searchin} variables of the functions.
 @end deffn
 
+@deftypefun uint8_t gal_table_displayflt_from_str (char @code{*string})
+Convert the input @code{string} into one of the 
@code{GAL_TABLE_DISPLAY_FMT_FIXED} (for fixed-point notation) or 
@code{GAL_TABLE_DISPLAY_FMT_EXP} (for exponential notation).
+@end deftypefun
+
+@deftypefun {char *} gal_table_displayflt_to_str (uint8_t @code{id})
+Convert the input identifier (one of the @code{GAL_TABLE_DISPLAY_FMT_FIXED}; 
for fixed-point notation, or @code{GAL_TABLE_DISPLAY_FMT_EXP}; for exponential 
notation) into a standard string that is used to identify them.
+@end deftypefun
+
 @deftypefun {gal_data_t *} gal_table_info (char @code{*filename}, char 
@code{*hdu}, gal_list_str_t @code{*lines}, size_t @code{*numcols}, size_t 
@code{*numrows}, int @code{*tableformat})
 Store the information of each column of a table into an array of data
 structures with @code{numcols} datasets (one data structure for each
diff --git a/lib/fits.c b/lib/fits.c
index 3901eb0b..da6be0dd 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -3055,7 +3055,7 @@ set_display_format(char *tdisp, gal_data_t *data, char 
*filename, char *hdu,
       break;
 
     case 'F':
-      data->disp_fmt=GAL_TABLE_DISPLAY_FMT_FLOAT;
+      data->disp_fmt=GAL_TABLE_DISPLAY_FMT_FIXED;
       break;
 
     case 'E':
diff --git a/lib/gnuastro/table.h b/lib/gnuastro/table.h
index 88658d1c..f2193a3a 100644
--- a/lib/gnuastro/table.h
+++ b/lib/gnuastro/table.h
@@ -55,7 +55,8 @@ __BEGIN_C_DECLS  /* From C++ preparations */
 
 
 /* 'printf' default formattings. Note that the string type shouldn't have
-   any precision and for the width,  */
+   any precision and for the width. The precisions are a little higher
+   because these are the default values. */
 #define GAL_TABLE_DEF_WIDTH_STR       6
 #define GAL_TABLE_DEF_WIDTH_INT       6
 #define GAL_TABLE_DEF_WIDTH_LINT      10
@@ -83,7 +84,7 @@ enum gal_table_diplay_formats
   GAL_TABLE_DISPLAY_FMT_UDECIMAL,       /* Integers: unsigned decimal. */
   GAL_TABLE_DISPLAY_FMT_OCTAL,          /* Integers: octal.            */
   GAL_TABLE_DISPLAY_FMT_HEX,            /* Integers: hexadecimal.      */
-  GAL_TABLE_DISPLAY_FMT_FLOAT,          /* Floats: with decimal point. */
+  GAL_TABLE_DISPLAY_FMT_FIXED,          /* Floats: fixed-point notation. */
   GAL_TABLE_DISPLAY_FMT_EXP,            /* Floats: as exponential.     */
   GAL_TABLE_DISPLAY_FMT_GENERAL,        /* Floats: general (%g in C).  */
 };
@@ -121,6 +122,18 @@ enum gal_table_where_to_search
 
 
 
+
+/************************************************************************/
+/***************            Internal conversions          ***************/
+/************************************************************************/
+uint8_t
+gal_table_displayflt_from_str(char *string);
+
+char *
+gal_table_displayflt_to_str(uint8_t fmt);
+
+
+
 /************************************************************************/
 /***************         Information about a table        ***************/
 /************************************************************************/
diff --git a/lib/table.c b/lib/table.c
index 582473c6..fe579877 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -43,6 +43,49 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 
+/************************************************************************/
+/***************            Internal conversions          ***************/
+/************************************************************************/
+uint8_t
+gal_table_displayflt_from_str(char *string)
+{
+  if(      !strcmp(string, "exp"))
+    return GAL_TABLE_DISPLAY_FMT_EXP;
+  else if (!strcmp(string, "fixed"))
+    return GAL_TABLE_DISPLAY_FMT_FIXED;
+  else return GAL_TABLE_DISPLAY_FMT_INVALID;
+}
+
+
+
+
+
+char *
+gal_table_displayflt_to_str(uint8_t fmt)
+{
+  switch(fmt)
+    {
+    case GAL_TABLE_DISPLAY_FMT_FIXED: return "fixed";
+    case GAL_TABLE_DISPLAY_FMT_EXP:   return "exp";
+    default:                          return NULL;
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/lib/tableintern.c b/lib/tableintern.c
index b96352bc..6b37fda5 100644
--- a/lib/tableintern.c
+++ b/lib/tableintern.c
@@ -352,18 +352,22 @@ gal_tableintern_col_print_info(gal_data_t *col, int 
tableformat,
     /* We need a default value (because in most cases, it won't be set. */
     case GAL_TYPE_FLOAT32:
     case GAL_TYPE_FLOAT64:
-      /* Set the format. */
-      switch(col->disp_fmt)
-        {
-        case GAL_TABLE_DISPLAY_FMT_FLOAT:
-          fmt[0] = tableformat==GAL_TABLE_FORMAT_TXT ? 'f' : 'F'; break;
-        case GAL_TABLE_DISPLAY_FMT_EXP:
-          fmt[0] = tableformat==GAL_TABLE_FORMAT_TXT ? 'e' : 'E'; break;
-        case GAL_TABLE_DISPLAY_FMT_GENERAL:
-          fmt[0] = tableformat==GAL_TABLE_FORMAT_TXT ? 'g' : 'E'; break;
-        default:
-          fmt[0] = tableformat==GAL_TABLE_FORMAT_TXT ? 'g' : 'E'; break;
-        }
+
+      /* Set the format. For FITS-ASCII, dealing with 'F' (fixed-point
+         notation) can create bad CFITSIO crashes if the total number of
+         digits becomes larger than the width. We won't have this problem
+         with 'E' (exponential) notation, so we'll just write all the
+         floating points in exponential notation. */
+      if(tableformat==GAL_TABLE_FORMAT_AFITS) fmt[0]='E';
+      else
+        switch(col->disp_fmt)
+          {
+          case GAL_TABLE_DISPLAY_FMT_FIXED:   fmt[0]='f'; break;
+          case GAL_TABLE_DISPLAY_FMT_EXP:     fmt[0]='e'; break;
+          case GAL_TABLE_DISPLAY_FMT_GENERAL: fmt[0]='g'; break;
+          default: /* '%f' is the most conservative in plain-text tables. */
+            fmt[0] = 'f'; break;
+          }
 
       /* Set the width and precision */
       switch(col->type)
@@ -377,16 +381,22 @@ gal_tableintern_col_print_info(gal_data_t *col, int 
tableformat,
         case GAL_TYPE_FLOAT64:
           width     = ( col->disp_width<=0
                         ? GAL_TABLE_DEF_WIDTH_DBL : col->disp_width );
-
-          /* CFITSIO doesn't recognize the double precision defined here
-             for ASCII FITS tables. */
           precision = ( col->disp_precision<=0
-                        ? ( tableformat==GAL_TABLE_FORMAT_TXT
-                            ? GAL_TABLE_DEF_PRECISION_DBL
-                            : GAL_TABLE_DEF_PRECISION_FLT )
-                        : col->disp_precision );
+                        ? GAL_TABLE_DEF_PRECISION_DBL : col->disp_precision );
           break;
         }
+
+      /* In ASCII-FITS tables, the full number (including the sign, the
+         point, the 'E+123' should fit within the width. For example in
+         '-7.32384000000E+04' (with a width of 18 characters), besides the
+         digits after the decimal point, we need the following 8 characters
+         '-7.E+NNN'. Therefore the precision should not be more than 10. If
+         the precision is more than this, CFITSIO is going to crash. We
+         should therefore correct it here. To be safe, we'll also add
+         another integer and leave 9 characters of the width for
+         non-precision characters. */
+      if(tableformat==GAL_TABLE_FORMAT_AFITS && width-precision<9)
+        precision=width-9;
       break;
 
 
diff --git a/lib/txt.c b/lib/txt.c
index 92329ac4..94e14c7c 100644
--- a/lib/txt.c
+++ b/lib/txt.c
@@ -1395,7 +1395,6 @@ make_fmts_for_printf(gal_data_t *datall, int leftadjust, 
size_t *len)
   size_t i=0, num=0;
   char fmt[2], lng[3];
 
-
   /* Allocate space for the output. */
   for(data=datall;data!=NULL;data=data->next) ++num;
   errno=0;
@@ -1404,11 +1403,9 @@ make_fmts_for_printf(gal_data_t *datall, int leftadjust, 
size_t *len)
     error(EXIT_FAILURE, errno, "%s: %zu bytes for fmts",
           __func__, FMTS_COLS*num*sizeof *fmts);
 
-
   /* Initialize the length to 0. */
   *len=0;
 
-
   /* Go over all the columns and make their formats. */
   for(data=datall;data!=NULL;data=data->next)
     {
@@ -1428,7 +1425,6 @@ make_fmts_for_printf(gal_data_t *datall, int leftadjust, 
size_t *len)
                                 ? gal_blank_as_string(data->type, 0)
                                 : NULL );
 
-
       /* Fill in the printing paramters. */
       gal_tableintern_col_print_info(data, GAL_TABLE_FORMAT_TXT, fmt, lng);
 
@@ -1444,15 +1440,25 @@ make_fmts_for_printf(gal_data_t *datall, int 
leftadjust, size_t *len)
          the final length of the overall format statement. The space in the
          end of 'fmts[i*2]' is to ensure that the columns don't merge, even
          if the printed string is larger than the expected width. */
-      if(data->disp_precision > 0)
-        *len += 1 + sprintf(fmts[i*FMTS_COLS], "%%%s%d.%d%s%s ",
-                            leftadjust ? "-" : "", data->disp_width,
-                            data->disp_precision, lng, fmt);
-      else
-        *len += 1 + sprintf(fmts[i*FMTS_COLS], "%%%s%d%s%s ",
-                            leftadjust ? "-" : "", data->disp_width,
-                            lng, fmt);
-
+      if(data->next)
+        {
+          if(data->disp_precision > 0)
+            *len += 1 + sprintf(fmts[i*FMTS_COLS], "%%%s%d.%d%s%s ",
+                                leftadjust ? "-" : "", data->disp_width,
+                                data->disp_precision, lng, fmt);
+          else
+            *len += 1 + sprintf(fmts[i*FMTS_COLS], "%%%s%d%s%s ",
+                                leftadjust ? "-" : "", data->disp_width,
+                                lng, fmt);
+        }
+      else /* Last column: no empty characters (no width or adjustment). */
+        {
+          if(data->disp_precision > 0)
+            *len += 1 + sprintf(fmts[i*FMTS_COLS], "%%.%d%s%s",
+                                data->disp_precision, lng, fmt);
+          else
+            *len += 1 + sprintf(fmts[i*FMTS_COLS], "%%%s%s", lng, fmt);
+        }
 
       /* Set the string for the Gnuastro type. For strings, we also need to
          write the maximum number of characters.*/
@@ -1462,7 +1468,6 @@ make_fmts_for_printf(gal_data_t *datall, int leftadjust, 
size_t *len)
       else
         strcpy(fmts[i*FMTS_COLS+1], gal_type_name(data->type, 0));
 
-
       /* Increment the column counter. */
       ++i;
     }
@@ -1739,26 +1744,14 @@ gal_txt_write(gal_data_t *input, struct 
gal_fits_list_key_t **keylist,
   switch(input->ndim)
     {
     case 1:
-      /* When the dataset is bring printed on standard output and its a
-         single number, don't print the column structure, because it will
-         add white-space characters which can be annoying when used in an
-         automatic script. */
-      if(fp==stdout && input->size==1 && input->next==NULL)
-        fprintf(fp, "%s\n",
-                gal_type_to_string(input->array, input->type, 0));
-
-      /* Dataset has more than one row AND more than one column, so follow
-         the basic text formatting (like extra white space to keep the
-         columns under each other). */
-      else
-        for(i=0;i<input->size;++i)                        /* Row.    */
-          {
-            j=0;
-            for(data=input;data!=NULL;data=data->next)    /* Column. */
-              txt_print_value(fp, data->array, data->type, i,
-                              fmts[j++ * FMTS_COLS]);
-            fprintf(fp, "\n");
-          }
+      for(i=0;i<input->size;++i)                        /* Row.    */
+        {
+          j=0;
+          for(data=input;data!=NULL;data=data->next)    /* Column. */
+            txt_print_value(fp, data->array, data->type, i,
+                            fmts[j++ * FMTS_COLS]);
+          fprintf(fp, "\n");
+        }
       break;
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]