Search notes:
Perl module Format::Human::Bytes
use warnings;
use strict;
# use bignum;
use Format::Human::Bytes;
show( 0);
show( 1);
show( 1000);
show( 1024);
show( 1000*1000);
show( 1000*1024);
show( 1024*1024);
show( 1000*1000*1000);
show( 1000*1000*1024);
show( 1000*1024*1024);
show( 1024*1024*1024);
# Too large values? bignum doesn't help...
#
# show( 1000*1000*1000*1000);
# show( 1000*1000*1000*1024);
# show( 1000*1000*1024*1024);
# show( 1000*1024*1024*1024);
# show( 1024*1024*1024*1024);
#
# show( 1000*1000*1000*1000*1000);
# show( 1000*1000*1000*1000*1024);
# show( 1000*1000*1000*1024*1024);
# show( 1000*1000*1024*1024*1024);
# show( 1000*1024*1024*1024*1024);
# show( 1024*1024*1024*1024*1024);
#
# show( 1000*1000*1000*1000*1000*1000);
# show( 1000*1000*1000*1000*1000*1024);
# show( 1000*1000*1000*1000*1024*1024);
# show( 1000*1000*1000*1024*1024*1024);
# show( 1000*1000*1024*1024*1024*1024);
# show( 1000*1024*1024*1024*1024*1024);
# show( 1024*1024*1024*1024*1024*1024);
sub show { # {{{
my $bytes = shift;
printf(" %10i %10s %10s\n",
$bytes,
Format::Human::Bytes::base2 ($bytes),
Format::Human::Bytes::base10($bytes),
);
} # }}}
__END__
0 0 0
1 1B 1B
1000 1000B 1000B
1024 1024B 1024B
1000000 977kB 1000kB
1024000 1000kB 1024kB
1048576 1024kB 1049kB
1000000000 954MB 1000MB
1024000000 977MB 1024MB
1048576000 1000MB 1049MB
1073741824 1024MB 1074MB