#!/usr/bin/perl -wl use strict; sub fract { %_=(%_,$_[0],$%); ~~%_ } print fract(0.1250); print fract(0.2500); print fract(0.3750); print fract(0.5000); print fract(0.6249); print fract(0.7510); print fract(0.8750); __END__ Prints: 1/8 2/8 3/8 4/8 5/8 6/8 7/8
Update: This is just a joke and apparently not a very good one. Don't use this code.
--
John.
In reply to Re: Percentages to Fractions
by jmcnamara
in thread Percentages to Fractions
by David Caughell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |