From svetosch@gmx.net Thu Apr 30 03:23:13 2009 From: Sven Schreiber To: gretl-devel@gretlml.univpm.it Subject: [Gretl-devel] stopwatch problem Date: Thu, 30 Apr 2009 09:22:26 +0200 Message-ID: <49F951B2.4030302@gmx.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2587305346445517071==" --===============2587305346445517071== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hi, I'm getting negative numbers from using $stopwatch differences, could there be some sort of underflow problem? What I do is a typical simulation exercise: set stopwatch t_sim1 = 0 loop for simrun=1..replications --quiet loop for t=1..T --quiet start = $stopwatch stop = $stopwatch t_sim1 += stop-start end loop # t end loop # simrun print t_sim1 And t_sim1 is reproducibly negative. However, in some other parts of the code, such cumulated running times are not producing negative output, so it's more subtle. That's also the reason why I'm not able to give you a minimal example so far, but I'll keep trying. Oh this is with a fairly new snapshot/cvs version, both on windows and linux. BTW and totally unrelated: Is it true that the user guide doesn't have a section on plain VARs? (as opposed to the great VECM ch.) thanks, sven --===============2587305346445517071==-- From cottrell@wfu.edu Thu Apr 30 20:23:57 2009 From: Allin Cottrell To: gretl-devel@gretlml.univpm.it Subject: Re: [Gretl-devel] stopwatch problem Date: Thu, 30 Apr 2009 20:23:56 -0400 Message-ID: In-Reply-To: 49F951B2.4030302@gmx.net MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2645902109039228804==" --===============2645902109039228804== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Thu, 30 Apr 2009, Sven Schreiber wrote: > I'm getting negative numbers from using $stopwatch differences, > could there be some sort of underflow problem? > > What I do is a typical simulation exercise: > > set stopwatch > t_sim1 = 0 > loop for simrun=1..replications --quiet > > loop for t=1..T --quiet > > start = $stopwatch > > stop = $stopwatch > > t_sim1 += stop-start > end loop # t > end loop # simrun > print t_sim1 > > And t_sim1 is reproducibly negative. Sven, please give a fully explicit test case. I'm not sure I understand the ellipses in your account. I tried the following complete example, broadly similar to what you stated: and it produced no negative results. Allin. --===============2645902109039228804==-- From cottrell@wfu.edu Sun May 3 16:10:30 2009 From: Allin Cottrell To: gretl-devel@gretlml.univpm.it Subject: Re: [Gretl-devel] stopwatch problem Date: Sun, 03 May 2009 16:10:30 -0400 Message-ID: In-Reply-To: Pine.A41.4.58.0904302014360.393364@f1n11.sp2net.wfu.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5543848921013712350==" --===============5543848921013712350== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Thu, 30 Apr 2009, Allin Cottrell wrote: > On Thu, 30 Apr 2009, Sven Schreiber wrote: > > > I'm getting negative numbers from using $stopwatch differences, > > could there be some sort of underflow problem? > > > > What I do is a typical simulation exercise: > > > > set stopwatch > > t_sim1 = 0 > > loop for simrun=1..replications --quiet > > > > loop for t=1..T --quiet > > > > start = $stopwatch > > > > stop = $stopwatch > > > > t_sim1 += stop-start > > end loop # t > > end loop # simrun > > print t_sim1 > > > > And t_sim1 is reproducibly negative. Ah, I tried this again using an exact copy of your script with filled in, and I did indeed get negative values of t_sim1. I was bothered at first, but then realized that's perfectly OK. I'd failed to notice the problem in your script. As per the manual, $stopwatch gives you the time _elapsed_ since "set stopwatch", or since the previous call to $stopwatch. Your calls start = $stopwatch ... stop = $stopwatch ... t_sim1 += stop-start seem to be assuming that $stopwatch gives you the current time, not the elapsed time: you want t_sim1 += $stopwatch. Allin. --===============5543848921013712350==-- From svetosch@gmx.net Mon May 4 05:01:32 2009 From: Sven Schreiber To: gretl-devel@gretlml.univpm.it Subject: Re: [Gretl-devel] stopwatch problem Date: Mon, 04 May 2009 11:01:24 +0200 Message-ID: <49FEAEE4.2030707@gmx.net> In-Reply-To: Pine.A41.4.58.0905031600170.745524@f1n11.sp2net.wfu.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1363850186467331386==" --===============1363850186467331386== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Am 03.05.2009 22:10, Allin Cottrell schrieb: > On Thu, 30 Apr 2009, Allin Cottrell wrote: > >> On Thu, 30 Apr 2009, Sven Schreiber wrote: >> >>> I'm getting negative numbers from using $stopwatch differences, >>> could there be some sort of underflow problem? >>> >>> What I do is a typical simulation exercise: >>> >>> set stopwatch >>> t_sim1 = 0 >>> loop for simrun=1..replications --quiet >>> >>> loop for t=1..T --quiet >>> >>> start = $stopwatch >>> >>> stop = $stopwatch >>> >>> t_sim1 += stop-start >>> end loop # t >>> end loop # simrun >>> print t_sim1 >>> >>> And t_sim1 is reproducibly negative. > > Ah, I tried this again using an exact copy of your script with > filled in, and I did indeed get negative values of t_sim1. > I was bothered at first, but then realized that's perfectly OK. > I'd failed to notice the problem in your script. > > As per the manual, $stopwatch gives you the time _elapsed_ since > "set stopwatch", or since the previous call to $stopwatch. Your > calls > > start = $stopwatch > ... > stop = $stopwatch > ... > t_sim1 += stop-start > > seem to be assuming that $stopwatch gives you the current time, > not the elapsed time: you want t_sim1 += $stopwatch. > Ah okay, my bad of course. sorry and thanks, sven --===============1363850186467331386==--