Re: TI Floor vs. Int


[Prev][Next][Index][Thread]

Re: TI Floor vs. Int



This is SPECULATION, but I believe that the guiding principle for inclusion
of the floor function was "You have a ceiling, you better have a floor."  (On
the other hand the guiding principle for the design of the cover was "You have
a ceiling, you have a floor.")

The ipart function corresponds to strip the sign, take the integer part, and
put the sign back.  Given that there is a floor function, the question is -
why do they need an int function? - but I guess it avoids questions like where
the @#$%%%^!!! is the int function.  But I do agree that it would make more
sense if int did what ipart does.

-----

In article <350AFD76.446B@daimi.aau.dk>,
  u971168@DAIMI.AAU.DK wrote:
>
> Justin Smith wrote:
> >
> >    Int and Floor seem to do the same thing to me.
> >
> > Any ideas if they are different or the same?
> >
> > Like maybe one example of when I'd use floor, and an example of when I'd
> > use int?
>
> The TI-92 manual clearly states that the two are identical.
> Problem is that the implementation if int() is different from system to
> system (a nuisance to C programmers :)
> Ideally, this is how they should work (IMNSHO):
>
> ceiling(x) - gives you the smallest integer >= x
>
> int(x) - returns the integer part of your x, i.e. throws away everything
> behind the comma.
>
> floor(x) - gives you the largest integer <= x
>
> TI has implemented int() to be identical to floor(). Why, I do not know,
> but I think it's ridiculous to have two identical functions. Someone
> should have thought "DUH!" when they wrote in the manual that these
> functions were indeed identical.
>
> To give you a complete overview[1], we can take a look at the five
> incidences that have interest, namely positive decimal, positive
> integer, zero, negative integer, and negative decimal:
> ce(x) = ceiling(x)
> TI(x) = TI's implementation of int(x)
> fl(x) = floor(x)
> my(x) = int(x) as I would like it to be :)
>
> |  x  | ce(x) | TI(x) | fl(x) | my(x) |
> |-----+-------+-------+-------+-------|
> | 2.5 |   3.  |   2.  |   2.  |   2.  |
> |  2  |   2   |   2   |   2   |   2   |
> |  0  |   0   |   0   |   0   |   0   |
> | -2  |  -2   |  -2   |  -2   |  -2   |
> |-2.5 |  -2.  |  -3.  |  -3.  |  -2   |
> |-----+-------+-------+-------+-------|
>
> As you can see here, the only difference in TI(x) and my(x) is when
> dealing with negative decimal numbers. A small difference, but still a
> significant one, if you ask me (or my friend here, who agrees :)
>
> HTH. HAND.
>
> [1] Normally I don't do ASCII diagrams because I know how annoying they
> are[2] when you don't use a mono-spaced font, but I'll do this one
> anyway :P
>
> [2] And not at all helpful.
>
> --
>           Rene Kragh Pedersen
> ------------------------------------------------------------------
> (2) When joining the two chain ends, the closing spring is to be
> pressed in, but in no other way than contrary to the running direction
> of the chain in the two closing grooves.
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


References: