Re: TIB: Re: int...


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

Re: TIB: Re: int...




In a message dated 98-03-12 16:40:45 EST, you write:

<< 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. >>

oops, sorry=====I didn't look at the top.  You're right.  If you want it to
round up after a certain point (like 1.2 and up becomes 2)

Let's say we want to round up after  .x

Then do:
    int(number + (1-.x))

Note:  its so easy to simplify this in your head, don't type it like that, or
it would take up more mem.  For the exaple rounding to 2 at 1.2, you would do:
    int(number + .8)

Sorry for any confusion