]> sourceware.org Git - lvm2.git/commit
libdm: implement dm_percent_to_round_float
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 24 Jun 2017 11:24:26 +0000 (13:24 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Sat, 24 Jun 2017 15:44:40 +0000 (17:44 +0200)
commit2ef8da61eb968acb3c5c51cdfdc997e8bed90352
tree142b7e6b56d77ce2336eb4d4974f3f13cad77d0b
parent0016b79c8b3223de7155fb4ec5fa799f7af1c811
libdm: implement dm_percent_to_round_float

Add function to adjust printing of percent values in better way.
Rounding here is going along following rules:

0% & 100% are always clearly reported with  .0 decimal points.

Values slightly above 0% we make sure a nearest bigger
non zero value with given precission is printed
(i.e. 0.01  for  %.2f  will be shown)

For values closely approaching 100% we again detect and adjust value
that is less then 100 when printed.
(i.e. 99.99  for %.2f will be shown).

For other values we are leaving them with standard rounding mechanism
since we care mainly about corner values 0 & 100 which need to be
printed precisely.
WHATS_NEW_DM
libdm/.exported_symbols.DM_1_02_141 [new file with mode: 0644]
libdm/libdevmapper.h
libdm/libdm-report.c
This page took 0.033533 seconds and 5 git commands to generate.