Prev: Newsreader Mayhem!
Next: Terminating an endless loop
From: Claire on 6 Jun 2010 17:51 Hello, If I have a variable declared as Long: Dim RingCount as Long can I do this: RingCount = Int((Timer - StartDial) / 2) or should I do this: RingCount = Abs((Timer - StartDial) / 2) or do this: RingCount = (Timer - StartDial) \ 2 Which one will be the best approach? Thanks, Claire
From: Bee on 6 Jun 2010 19:01 Well, I would not use Timer since it rolls over at midnight. Then (also) using Abs() might give you a really bad number if you use Timer. And what is StartDial declared as? Timer returns a Single according to Help. "Claire" wrote: > Hello, > If I have a variable declared as Long: > > Dim RingCount as Long > > can I do this: > RingCount = Int((Timer - StartDial) / 2) > or should I do this: > RingCount = Abs((Timer - StartDial) / 2) > or do this: > RingCount = (Timer - StartDial) \ 2 > > Which one will be the best approach? > > Thanks, > Claire > > > > > . >
From: Claire on 6 Jun 2010 19:41 I am not concerned about Timer rolling over at midnight StartDial is declared as Single. "Bee" <Bee(a)discussions.microsoft.com> wrote in message news:82A55D57-B142-42C1-BB43-01FF3202D219(a)microsoft.com... > > Well, I would not use Timer since it rolls over at midnight. > > Then (also) using Abs() might give you a really bad number if you use > Timer. > > And what is StartDial declared as? > > Timer returns a Single according to Help. > > "Claire" wrote: > >> Hello, >> If I have a variable declared as Long: >> >> Dim RingCount as Long >> >> can I do this: >> RingCount = Int((Timer - StartDial) / 2) >> or should I do this: >> RingCount = Abs((Timer - StartDial) / 2) >> or do this: >> RingCount = (Timer - StartDial) \ 2 >> >> Which one will be the best approach? >> >> Thanks, >> Claire >> >> >> >> >> . >>
From: MikeD on 6 Jun 2010 20:28 "Bee" <Bee(a)discussions.microsoft.com> wrote in message news:82A55D57-B142-42C1-BB43-01FF3202D219(a)microsoft.com... > > Well, I would not use Timer since it rolls over at midnight. > Depends on what she's using it for. A "midnight rollover" might never be an issue. > Then (also) using Abs() might give you a really bad number if you use > Timer. How so? As far as I can see, using Abs would not cause a runtime error. It might result in erroneous data, but not enough info provided to say if it would or not.
From: MikeD on 6 Jun 2010 20:32
"Claire" <replyto(a)fra> wrote in message news:eW9byJcBLHA.5848(a)TK2MSFTNGP06.phx.gbl... > Hello, > If I have a variable declared as Long: > > Dim RingCount as Long > > can I do this: > RingCount = Int((Timer - StartDial) / 2) > or should I do this: > RingCount = Abs((Timer - StartDial) / 2) > or do this: > RingCount = (Timer - StartDial) \ 2 > > Which one will be the best approach? > What is that you're ultimately wanting? You can do any of those 3 things, but without knowing the ultimate goal, it's impossible to tell you which of those 3 choices, or something else, would be best. |