title: Perl module to convert between MB/GB/TB without converting to bytes first?
body: <p>I'm trying to calculate the free space on an LVM physical volume by multiplying the number of free physical extents by the extent size, for example:</p>
  
  <pre><code>3623365 free extents * 4.00 MB each = 13.8 TB
  </code></pre>
  
  <p>I was using <a href="http://search.cpan.org/~wrw/Number-Format-1.73/Format.pm" rel="nofollow">Number::Format</a> to convert the extent size to bytes and convert the results of the multiplication back to a human-readable string, but TB and higher are not supported, so I end up with the longer, less readable <code>14,153.8 GB</code>.</p>
  
  <p>According to the docs, the reason TB and up are not supported is because of integer overflows on 32-bit systems, which made me wonder if I should even be multiplying arbitrary large numbers without using something like <a href="http://perldoc.perl.org/Math/BigInt.html" rel="nofollow">Math::BigInt</a>. I see that <a href="http://search.cpan.org/~dagobert/Number-Bytes-Human/Human.pm" rel="nofollow">Number::Bytes::Human</a> supports numbers up to YB (yottabytes), but it's still in alpha so I hesitate to use it in production code.</p>
  
  <p>My next thought was, why even convert to bytes in the first place when I could calculate the free space in MB and then convert to TB? Unfortunately, it seems like neither <a href="http://search.cpan.org/~wrw/Number-Format-1.73/Format.pm" rel="nofollow">Number::Format</a> nor <a href="http://search.cpan.org/~dagobert/Number-Bytes-Human/Human.pm" rel="nofollow">Number::Bytes::Human</a> supports conversions from one "suffix" to another, e.g. MB -> TB. Is there an existing module that does this? I really like how <a href="http://search.cpan.org/~wrw/Number-Format-1.73/Format.pm" rel="nofollow">Number::Format</a> and <a href="http://search.cpan.org/~dagobert/Number-Bytes-Human/Human.pm" rel="nofollow">Number::Bytes::Human</a> handle both SI/non-SI units (MB vs. MiB), allow you to set the precision, etc. and so hesitate to roll my own solution if a similarly full-featured module already does it.</p>
  
  <p><strong>Edit:</strong> The extent size is not always in MB, nor is the free space always in TB, so I am not asking how to convert from MB to TB (that would be trivial). I <em>am</em> asking if there are any existing modules that can convert from one [arbitrary] suffix to another without converting to bytes first.</p>