Kevin Ryde > Math-NumSeq-64 > Math::NumSeq::RadixConversion

Math-NumSeq-64.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 1
View/Report Bugs
Module Version: 64   Source   Latest Release: Math-NumSeq-67

# SYNOPSIS

my (\$i, \$value) = \$seq->next;

# DESCRIPTION

This sequence is the index i converted from one radix to another. The default is from binary to decimal,

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, ...
starting i=0

For example i=3 in binary is 0b11 which is interpreted as decimal for value 11, ie. eleven.

When from_radix < to_radix the effect is to give values which in to_radix use only the digits of from_radix. The default is all integers which in decimal use only the binary digits, ie. 0 and 1.

When from_radix > to_radix the conversion is a reduction. The calculation is still a breakdown and re-assembly

but because to_radix is smaller the value is smaller than the index i. For example from_radix=10 and to_radix=8 turns i=345 into value=3*8^2+4*8+5=229.

# FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

Create and return a new sequence object.

## Random Access

\$value = \$seq->ith(\$i)

\$bool = \$seq->pred(\$value)

Return true if \$value occurs in the sequence.

http://user42.tuxfamily.org/math-numseq/index.html