On Fri, 28 Feb 2003, Rick Measham wrote: > On 28/2/03 3:52 pm, Dave Rolsky at [EMAIL PROTECTED] spake thus: > > Finally, I think that Perl's built-in int() function does everything that > > floor() is being used for. POSIX is a big memory hog, so getting rid of > > it is a good thing. > > Don't be too sure Dave ... years before 0 and the difference is great. > Consider this: > > use POSIX qw/floor/; > print "int : " . int(-243.23) . "\n"; > # int : -243 > print "floor: " . floor(-243.23) . "\n"; > # floor: -244
Oh yeah, good point. > If POSIX isn't brought in, then at least a local floor should be > implemented: > > sub floor($) { > return 0 unless $_[0]*1 == $_[0]; # This might not be the best way :) > return int($_[0]) if $_[0] >= 0; > return int($_[0]) -1; > } That might be better. POSIX is pretty bulky, although you can save about 400KB or its 800KB if you just do "use POSIX ()" and don't let it import all its crap into your namespace. In general, I'm not very fond of it, because its basically a dumping grounds of random C-interface un-Perlish stuff that IMO, would be better of put into smaller, better defined Perl modules. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/