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

NAME

Math::NumSeq::FractionDigits -- the digits of a fraction p/q

SYNOPSIS

 use Math::NumSeq::FractionDigits;
 my $seq = Math::NumSeq::FractionDigits->new (fraction => '2/11');
 my ($i, $value) = $seq->next;

DESCRIPTION

The sequence of digits which are a given fraction. For example 1/7 in decimal 1,4,2,8,5,7,1,4, etc, being 0.14285714...

The digits are always a repeating sequence of length no more than den-1. In fact for a given repeating sequence a,b,c,a,b,c,etc the fraction is abc/999, if you want to cook up a sequence like that. In a base other than decimal the "9" is radix-1, ie. the highest digit.

FUNCTIONS

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

$seq = Math::NumSeq::FractionDigits->new (fraction => $f)
$seq = Math::NumSeq::FractionDigits->new (fraction => $f, radix => $r)

Create and return a new sequence object giving the digits of $f. $f is a string "num/den", or a decimal "xx.yy",

    2/29
    1.5/3.25
    29.125

The default is digits in decimal, or with the radix parameter in another base.

SEE ALSO

Math::NumSeq, Math::NumSeq::SqrtDigits

HOME PAGE

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

LICENSE

Copyright 2010, 2011 Kevin Ryde

Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.