diff options
| author | Abigail <abigail@abigail.be> | 2021-04-04 15:51:00 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-04-04 15:51:00 +0200 |
| commit | 4b461cb77f2cdb22c43130398dcbc65cbc6ac996 (patch) | |
| tree | 00f78556791ca50d227137ed0934634607cabf3c /challenge-106 | |
| parent | d3c5acbc661c1ef98c75e4a9bf2a7c38fda16235 (diff) | |
| download | perlweeklychallenge-club-4b461cb77f2cdb22c43130398dcbc65cbc6ac996.tar.gz perlweeklychallenge-club-4b461cb77f2cdb22c43130398dcbc65cbc6ac996.tar.bz2 perlweeklychallenge-club-4b461cb77f2cdb22c43130398dcbc65cbc6ac996.zip | |
Remark we are not dealing with negative numbers in the input
Diffstat (limited to 'challenge-106')
| -rw-r--r-- | challenge-106/abigail/README.md | 3 | ||||
| -rw-r--r-- | challenge-106/abigail/perl/ch-2.pl | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/challenge-106/abigail/README.md b/challenge-106/abigail/README.md index 493e730736..38eaa65584 100644 --- a/challenge-106/abigail/README.md +++ b/challenge-106/abigail/README.md @@ -54,6 +54,9 @@ Output: "0.0(75)" ### Notes +We are assuming the numerator is non-negative, and the denominator +is positive. Dealing with signs is left as an exercise to the reader. + We're creation the decimal expansion of the fraction `$N / $D` by performing long division. diff --git a/challenge-106/abigail/perl/ch-2.pl b/challenge-106/abigail/perl/ch-2.pl index f53e393e9e..a5857147eb 100644 --- a/challenge-106/abigail/perl/ch-2.pl +++ b/challenge-106/abigail/perl/ch-2.pl @@ -18,6 +18,11 @@ use experimental 'lexical_subs'; # # +# We are assuming the input consists of pairs of non-negative +# integers, with the denominator greater than 0. +# + +# # To determine the repeating digits of a fraction, it's very tempting # to use sprintf with a large amount of digits, and see what repeats. # But Perl isn't precise enough even for small numbers to do so. @@ -33,7 +38,6 @@ use experimental 'lexical_subs'; # after the 70th, are 0. # - # # We're creation the decimal expansion of the fraction $N / $D # by performing long division. |
