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 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); }

You're right. I was only thinking of positive numbers. My bad. Sorry.


James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to