tools: Fix convertion numbers to human readable IEC format

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