Math::BaseCalc

Math::BaseCalc is a Perl module that can convert numbers between various bases.
Download

Math::BaseCalc Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ken Williams
  • Publisher web site:
  • http://search.cpan.org/~kwilliams/Module-Build-0.2808/lib/Module/Build/Compat.pm

Math::BaseCalc Tags


Math::BaseCalc Description

Math::BaseCalc is a Perl module that can convert numbers between various bases. Math::BaseCalc is a Perl module that can convert numbers between various bases.SYNOPSIS use Math::BaseCalc; my $calc = new Math::BaseCalc(digits => ); #Binary my $bin_string = $calc->to_base(465); # Convert 465 to binary $calc->digits('oct'); # Octal my $number = $calc->from_base('1574'); # Convert octal 1574 to decimalThis module facilitates the conversion of numbers between various number bases. You may define your own digit sets, or use any of several predefined digit sets.The to_base() and from_base() methods convert between Perl numbers and strings which represent these numbers in other bases. For instance, if you're using the binary digit set , $calc->to_base(5) will return the string "101". $calc->from_base("101") will return the number 5.To convert between, say, base 7 and base 36, use the 2-step process of first converting to a Perl number, then to the desired base for the result: $calc7 = new Math::BaseCalc(digits=>); $calc36 = new Math::BaseCalc(digits=>; $in_base_36 = $calc36->to_base( $calc7->from_base('3506') );If you just need to handle regular octal & hexdecimal strings, you probably don't need this module. See the sprintf(), oct(), and hex() Perl functions. Requirements: · Perl


Math::BaseCalc Related Software