Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > roundup to 60 or 70 or 50

Reply
Thread Tools

roundup to 60 or 70 or 50

 
 
Antoine Adams
Guest
Posts: n/a
 
      11-09-2003
This is probably an easy question but i'm in it so deep that i totally
do not see the answer.

I get the number 61;
I need to know the nearest decimal up. So I need to know 70.

how do I do that?

I'm totally stuck.
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      11-09-2003
Antoine Adams wrote:
> I get the number 61;
> I need to know the nearest decimal up. So I need to know 70.


$roundup = $num % 10 ? $num - $num % 10 + 10 : $num;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
 
 
 
Randal L. Schwartz
Guest
Posts: n/a
 
      11-09-2003
>>>>> "Antoine" == Antoine Adams <(E-Mail Removed)> writes:

Antoine> I get the number 61;
Antoine> I need to know the nearest decimal up. So I need to know 70.

I usually cheat with something like 10*int(($num+9)/10), if I know
they're all integers.

print "Just another Perl hacker,"

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<(E-Mail Removed)> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
 
Reply With Quote
 
Antoine Adams
Guest
Posts: n/a
 
      11-10-2003
> print "Just another Perl hacker,"

Ok ok.. thx guys.

3 solutions and all three work..
I liked them all and tested them all

Thx thx thx thx

Now I can continue playing with GD::Graph and mysql data uotput sorting

----
A G-string fits better then a perl string
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Roundup-users] Roundup Issue Tracker release 1.4.7 Richard Jones Python 0 03-14-2009 12:24 AM
SLI Power Supply Roundup @ PC Modding Malaysia Silverstrand Front Page News 2 09-26-2005 07:03 AM
HEXUS PSU (Power Supply Unit) Roundup - Taoyuan 2005 Silverstrand Front Page News 2 09-24-2005 04:50 AM
CompactFlash Card Roundup: 1GB Models Silverstrand Front Page News 0 08-29-2005 05:12 PM
Foxconn Intel Dual Core Mainboard Roundup Silverstrand Front Page News 0 08-01-2005 08:18 PM



Advertisments