Wouldn't it be nice if more things in life had a built-in fix() function? Cars, pets, relationships...
On Mon, 25 Oct 2004 13:28:32 -0700, Sean Corfield <[EMAIL PROTECTED]> wrote: > On Tue, 26 Oct 2004 08:26:57 +1300, Adam Cameron <[EMAIL PROTECTED]> wrote: > > "int()" should return the integer component of a number. Yet last time > > I tested, int(-4.9) would return -5. So "int()" kind of works like > > "round()", which is a different thing. The (your) response was "well > > it's documented to work that way, so neener neener neener" (or something > > like that ;-) > > Ah yes, I remember now. > > int() "Calculates the closest integer that is smaller than number" so > int(-4.9) is -5.-4 is *bigger* than -4.9 (since -4 gt -4.9) so > returning -4 would be wrong. > > The function you want is fix() which is documented as: > > "Converts a real number to an integer. > > If number is greater than or equal to 0, the closest integer less than number. > > If number is less than 0, the closest integer greater than number." > > > -- > Sean A Corfield -- http://www.corfield.org/ > Team Fusebox -- http://www.fusebox.org/ > Got Gmail? -- I have 1 invite > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > ---------------------------------------------------------- > You are subscribed to cfcdev. To unsubscribe, send an email > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > in the message of the email. > > CFCDev is run by CFCZone (www.cfczone.org) and supported > by Mindtool, Corporation (www.mindtool.com). > > An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
