Re: TIB: Re: int...


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

Re: TIB: Re: int...






ti-basic@lists.ticalc.org wrote:

> In a message dated 98-03-12 15:56:25 EST, you write:
>
> << > In a message dated 98-03-11 18:17:17 EST, you write:
>  >
>  > << how do you use int so it goes up?
>  >  like 1.2 returns 2. >>
>  >
>  > Try, int(number+.5,0
>
>   close, but no cigar.  that would still display 1. you need to use
>  int(num+1) or round(num+.5,0) >>
>
> that would round up if number is greater than or equal to 1.5.

that is what he wanted it to do.  1.2=>2, 1.5=>2, 1.7=>2, which it
does.  the problem comes when the number is an integer ie. 1 rounds to
2, 2=>3, etc.i gave a different solution to the problem that works, but
someone else (i forgot who, sorry) gave this, which is THE BEST way:
-int(-number)

-brian ash




References: