What should an int() function do?
- From: Chris Carlen <crcarleRemoveThis@xxxxxxxxxxxxxxx>
- Date: Fri, 26 Aug 2005 17:00:03 -0700
Greetings:
I would think that an int() function should return the integer part of a number by simply erasing the part after the decimal place:
int(0.5)=0 int(1.2)=1 int(1)=1 int(-0.4)=0 int(-2.3)=-2
A floor() function shuold always return the integer less than or equal to its argument:
floor(0.5)=0 floor(1.2)=1 floor(1)=1 floor(-0.4)=-1 floor(-2.3)=-3
And a ceiling() function should return the integer greater or equal to its argument:
ceiling(0.5)=1 ceiling(1.2)=2 ceiling(1)=1 ceiling(-0.4)=0 ceiling(-2.3)=-2
Thus the int() function could be defined as (in math notation, not computer code):
int(x) = {
floor(x), x>=0
ceiling(x), x<0 }But my TI-89 calculator seems to do this:
int(x) = floor(x)
Is this a crummy implementation of int() ?
-- Good day!
________________________________________ Christopher R. Carlen Principal Laser&Electronics Technologist Sandia National Laboratories CA USA crcarleRemoveThis@xxxxxxxxxxxxxxx NOTE, delete texts: "RemoveThis" and "BOGUS" from email address to reply. .
- Follow-Ups:
- Re: What should an int() function do?
- From: David C . Ullrich
- Re: What should an int() function do?
- From: Virgil
- Re: What should an int() function do?
- From: mensanator@xxxxxxxxxxx
- Re: What should an int() function do?
- From: A N Niel
- Re: What should an int() function do?
- From: matt271829-news
- Re: What should an int() function do?
- Prev by Date: Re: 4-dimensional Integral -
- Next by Date: Re: What does G?del's Incompleteness mean for the Working Mathematician?
- Previous by thread: Points and numbers.
- Next by thread: Re: What should an int() function do?
- Index(es):
Relevant Pages
|