On Wed, 2002-04-17 at 13:46, drieux wrote:
>
> On Wednesday, April 17, 2002, at 10:12 , bob ackerman wrote:
>
> > for integers:
> > (add one) divide by 2.
> > $rndup = ($var+1)/2;
>
> that would give you a float
>
> print "half of $_ rounded up is " . ( ($_ + 1) / 2) . "\n"
>
On Wed, Apr 17, 2002 at 01:01:45PM -0400, Glenn Cannon wrote:
> I am dividing a number by 2. How do I force a round up of the result?
perldoc -q round
or
http://www.perldoc.com/perl5.6.1/pod/perlfaq4.html third question
Michael
--
Administrator www.shoebox.net
Programmer
On Wednesday, April 17, 2002, at 10:12 , bob ackerman wrote:
> for integers:
> (add one) divide by 2.
> $rndup = ($var+1)/2;
that would give you a float
print "half of $_ rounded up is " . ( ($_ + 1) / 2) . "\n"
foreach (@ARGV) ;
perl /tmp/drieux/roundup.p
for integers:
(add one) divide by 2.
$rndup = ($var+1)/2;
On Wednesday, April 17, 2002, at 10:01 AM, Glenn Cannon wrote:
> I am dividing a number by 2. How do I force a round up of the result?
>
> Glenn.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PR
On Wed, 2002-04-17 at 13:01, Glenn Cannon wrote:
> I am dividing a number by 2. How do I force a round up of the result?
>
> Glenn.
There is undoubtedly a module for this, but here are some off the top of
my head solutions:
Unconditional round-up (ceiling):
$ceiling = int($num+.5) == int($nu
I am dividing a number by 2. How do I force a round up of the result?
Glenn.