diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-05-01 16:46:58 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-05-01 16:46:58 (GMT) |
commit | bee6951ac63e64c01281ac0d48a7c9068b4a0c08 (patch) | |
tree | a114b8857c48957edeecd71a9b4e1d800bd92faa /tools/h5dump | |
parent | b2a2c17c44bdf53a27b0f868752c9d6f6148e1ad (diff) | |
download | hdf5-bee6951ac63e64c01281ac0d48a7c9068b4a0c08.zip hdf5-bee6951ac63e64c01281ac0d48a7c9068b4a0c08.tar.gz hdf5-bee6951ac63e64c01281ac0d48a7c9068b4a0c08.tar.bz2 |
[svn-r14906] Introduced a ratio formula compression ratio = uncompressed size / compressed size
in the printing of the compression with 3 digits of precision per hdf-forum NASA developers suggestion
tested: windows, linux, solaris
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index f951efc..70d845d 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2507,7 +2507,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) int ndims = H5Sget_simple_extent_dims( sid, dims, NULL); hsize_t nelmts = 1; hsize_t size; - double per = 0; + double ratio = 0; hssize_t a, b; int ok = 0; @@ -2538,14 +2538,14 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) } size = nelmts * datum_size; - a = size; b = storage_size; - if (a!=0) - per = (double) (b-a)/a; - - per = -per; - per *=100; + a = size; b = storage_size; + + /* compression ratio = uncompressed size / compressed size */ - HDfprintf(stdout, "SIZE %Hu (%.1f%%COMPRESSION)\n ", storage_size, per); + if (b!=0) + ratio = (double) a / (double) b; + + HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio); } else |