Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^4: Recurring Cycle of Fractions

by Skeeve (Vicar)
on Sep 10, 2007 at 11:05 UTC ( #638029=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Recurring Cycle of Fractions
in thread Recurring Cycle of Fractions

No. Don't try it with 170 but with another, carefully crafted fraction: 102/900

#!/usr/bin/perl use Math::BigFloat; Math::BigFloat->div_scale(50); my @values = map { my $i = Math::BigFloat->new( 102 ); scalar $i->bdiv( $_ ); } (900); for (@values) { /\.\d*?(\d+?)\1/; print "$_: $1\n" }
Output: 0.113333333333333333333...333: 1

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e


Comment on Re^4: Recurring Cycle of Fractions
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://638029]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-03 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (55 votes), past polls