dextius has asked for the wisdom of the Perl Monks concerning the following question:
Simple question. I need a simple way of detecting values that are "sub penny".. Is there a better way to do it than this? (I believe the code is correct, but I'm hoping there may be a faster implementation)
sub is_subpenny { my $number = $_[0]; return (($number*100) - int($number*100) > 0); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: modulus and floating point numbers
by GrandFather (Saint) on Nov 18, 2008 at 02:34 UTC | |
Re: modulus and floating point numbers
by BrowserUk (Patriarch) on Nov 18, 2008 at 02:57 UTC | |
by dextius (Monk) on Nov 18, 2008 at 03:15 UTC | |
by BrowserUk (Patriarch) on Nov 18, 2008 at 03:34 UTC | |
Re: modulus and floating point numbers
by ccn (Vicar) on Nov 18, 2008 at 03:17 UTC | |
by dextius (Monk) on Nov 18, 2008 at 03:28 UTC | |
by ccn (Vicar) on Nov 18, 2008 at 06:14 UTC | |
by gone2015 (Deacon) on Nov 18, 2008 at 18:57 UTC | |
Re: modulus and floating point numbers
by ccn (Vicar) on Nov 18, 2008 at 02:45 UTC |
Back to
Seekers of Perl Wisdom