Re: Perl Equavlent

2003-11-18 Thread R. Joseph Newton
Tore Aursand wrote: > On Sun, 16 Nov 2003 23:24:29 -0800, R. Joseph Newton wrote: > > If you want to round, use: > > my $rounded = int ($float_value + 0.5); > > ...which only works if you have a positive number. You must make it a bit > more foolproof; > > my $rounded = ($nr > 0) ? int($nr + 0.

Re: Perl Equavlent

2003-11-17 Thread James Edward Gray II
On Nov 17, 2003, at 1:24 AM, R. Joseph Newton wrote: Mike Blezien wrote: So if I use the int() this will provide the same results as this ceil() function does... ?? Nope. Same as floor(). If you want to round, use: my $rounded = int ($float_value + 0.5); Please read the rest of the thread be

Re: Perl Equavlent

2003-11-17 Thread Tore Aursand
On Sun, 16 Nov 2003 23:24:29 -0800, R. Joseph Newton wrote: > If you want to round, use: > my $rounded = int ($float_value + 0.5); ...which only works if you have a positive number. You must make it a bit more foolproof; my $rounded = ($nr > 0) ? int($nr + 0.5) : int($nr - 0.5); -- Tore Aur

Re: Perl Equavlent

2003-11-17 Thread R. Joseph Newton
Mike Blezien wrote: > Hi, > > So if I use the int() this will provide the same results as this ceil() function > does... ?? Nope. Same as floor(). If you want to round, use: my $rounded = int ($float_value + 0.5); Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

Re: Perl Equavlent

2003-11-13 Thread Rob Dixon
Mike Blezien wrote: > > Ran accross a function called "ceil" and from the information I got on this: > > "ceil() [Stands for ceiling], it just rounds a float value up.. so ceil(4.7) == > ceil(4.1342) == 5" > > would this be the same as using "int" function in perl or is there function in > perl cal

Re: Perl Equavlent

2003-11-13 Thread George Schlossnagle
On Nov 13, 2003, at 11:38 AM, Mike Blezien wrote: Hi, so I guess my question is, if I want to accomplish the same results as this "ceil" how would that be accomplished in Perl ?? use POSIX qw/ceil/; $float = '1.9'; print ceil($float); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

Re: Perl Equavlent

2003-11-13 Thread Mike Blezien
Yes, this did the trick exactly :) thanks for your help -- MikeBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Quality Web Hosting http://www.justlightening.net MSN: [EMAIL PROTECTED] =-=-=-=-=-=-

Re: Perl Equavlent

2003-11-13 Thread James Edward Gray II
On Nov 13, 2003, at 10:38 AM, Mike Blezien wrote: Hi, so I guess my question is, if I want to accomplish the same results as this "ceil" how would that be accomplished in Perl ?? Does this one-liner get you started? perl -e 'use POSIX qw(ceil); print ceil(2.3), "\n";' James -- To unsubscribe,

Re: Perl Equavlent

2003-11-13 Thread Mike Blezien
Hi, so I guess my question is, if I want to accomplish the same results as this "ceil" how would that be accomplished in Perl ?? thx's -- MikeBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Quali

Re: Perl Equavlent

2003-11-13 Thread James Edward Gray II
On Nov 13, 2003, at 10:17 AM, Mike Blezien wrote: So if I use the int() this will provide the same results as this ceil() function does... ?? No, it's not the same. See the chart earlier in this thread. Sorry for confusing the issue. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Re: Perl Equavlent

2003-11-13 Thread Mike Blezien
Hi, So if I use the int() this will provide the same results as this ceil() function does... ?? thx's -- MikeBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Quality Web Hosting http://www.justl

Re: Perl Equavlent

2003-11-13 Thread James Edward Gray II
On Nov 13, 2003, at 10:01 AM, Jeff 'japhy' Pinyan wrote: No, int() is neither exactly like ceil() or floor(). All int() does is truncate the number to an integer. If you have 2.3, you get 2. If you have 2.9, you get 2. If you have -2.3, you get -2. If you have -2.9, you get -2. If you were

Re: Perl Equavlent

2003-11-13 Thread Rob Dixon
James Edward Gray II wrote: > > On Nov 13, 2003, at 9:50 AM, Bob Showalter wrote: > > > Mike Blezien wrote: > >> Hi, > >> > >> Ran accross a function called "ceil" and from the information I got > >> on this: > >> > >> "ceil() [Stands for ceiling], it just rounds a float value up.. so > >> ceil(4.7

Re: Perl Equavlent

2003-11-13 Thread Jeff 'japhy' Pinyan
On Nov 13, James Edward Gray II said: >On Nov 13, 2003, at 9:50 AM, Bob Showalter wrote: > >> Mike Blezien wrote: >>> Hi, >>> >>> Ran accross a function called "ceil" and from the information I got >>> on this: >>> >>> "ceil() [Stands for ceiling], it just rounds a float value up.. so >>> ceil(4.7

Re: Perl Equavlent

2003-11-13 Thread James Edward Gray II
On Nov 13, 2003, at 9:50 AM, Bob Showalter wrote: Mike Blezien wrote: Hi, Ran accross a function called "ceil" and from the information I got on this: "ceil() [Stands for ceiling], it just rounds a float value up.. so ceil(4.7) == ceil(4.1342) == 5" would this be the same as using "int" function

RE: Perl Equavlent

2003-11-13 Thread Bob Showalter
Mike Blezien wrote: > Hi, > > Ran accross a function called "ceil" and from the information I got > on this: > > "ceil() [Stands for ceiling], it just rounds a float value up.. so > ceil(4.7) == ceil(4.1342) == 5" > > would this be the same as using "int" function in perl No. int() simply drop