tools: Fix conversion numbers to human readable IEC format

Function 'print_humanized_number' has been refactored.
In addition there was a bug for 'IEC' format convertion:
Old function was returning e.g.: '1.0KiB' for '1023' bytes..
The bug was a result of using always '1000' as a 'base'
for both 'SI' and 'IEC' rounding. The 'base' should be accordingly:
'1000' and '1024', even for rounding.