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 -- Mike<mickalo>Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Quality Web Hosting http://www.justlightening.net MSN: [EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> Jeff 'japhy' Pinyan wrote:
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) == ceil(4.1342) == 5"
would this be the same as using "int" function in perl
No. int() simply drops the fractional part.
ceil() is often presented with a sister function called floor(). That would be the same as Perl's int().
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 to write int() as a function of ceil() and/or floor(), you'd have to say:
sub int { my $x = shift; $x > 0 ? floor($x) : ceil($x); }
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]