Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl: the Markov chain saw
 
PerlMonks  

How do I convert a number to a fraction and vice versa?

by PodMaster (Abbot)
on Jul 26, 2003 at 06:28 UTC ( [id://278079]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

PodMaster has asked for the wisdom of the Perl Monks concerning the following question: (numbers)

Originally posted as a Categorized Question. Body may be blank.

  • Comment on How do I convert a number to a fraction and vice versa?

Replies are listed 'Best First'.
Re: How do I convert a number to a fraction and vice versa?
by PodMaster (Abbot) on Jul 26, 2003 at 06:32 UTC
    use Number::Fraction:
    use Number::Fraction; my @dimensions = ( 320, 240 ); my $aspect = Number::Fraction->new( @dimensions ); print join('x', @dimensions); print $aspect; print $aspect->to_num;
    320x240 4/3 1.33333333333333

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://278079]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.