The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::BaseArith - Perl extension for mixed-base number representation (like APL encode/decode)

SYNOPSIS

  use Math::BaseArith qw( :all );

  encode_base( value, base_listref );

  decode_base( representation_listref, base_listref );

DESCRIPTION

The inspiration for this module is a pair of functions in the APL programming language called encode (a.k.a. "represent" or "antibase)" and decode (a.k.a. base). Their principal use is to convert numbers from one number base to another. Mixed number bases are permitted.

In this perl implementation, the representation of a number in a particular number base consists of a list refence (listref) whose elements are the digit values in that base. For example, the decimal number 31 would be expressed in binary as a list of five ones with any number of leading zeros: [0, 0, 0, 1, 1, 1, 1, 1]. The same number expressed as three hexadecimal (base 16) digits would be [0, 1, 15], while in base 10 it would be [0, 3, 1]. Fifty-one inches would be expressed in yards, feet, inches as [1, 1, 3], an example of a mixed number base.

AUTHOR

Gary Puckering <jgpuckering@rogers.com> (CPAN author PUCKERING)