prev | index | [back] | next     a /usr/bin/perl script text executable     [image by itself: disk-sizes.pl]
[next]
#!/usr/bin/perl
# Purpose: Calculates disk sizes as defined by IDEMA.

# www.idema.org/wp-content/plugins/download-monitor/download.php?id=1223
#
#   The LBA count shall be calculated using the following formula:
#   LBA count = (97696368) + (1953504 * (Desired Capacity in Gbytes - 50.0))

sub lba { 97696368 + (1953504 * ($_[0] - 50.0)); }
sub cma { $n = shift; 1 while $n =~ s/(.*\d)(\d\d\d)/$1,$2/; $n;}

@s = @ARGV or @s = (1_000, 1_500, 2_000, 2_500, 3_000);
for $gb (@s) {
  $lba = lba($gb);
  $_ = $lba * 512;
  print "$gb = $lba blocks = ", cma $_;
  while ($_ > 400) {
    $_ = $_ / 1024;
    print cma(sprintf "  %.3f", $_);
  }
  print "\n";
}


prev | index | [back] | next     a /usr/bin/perl script text executable
33 of 43:  disk-sizes.pl  19-Apr-2018 02:26  1.00K