View Single Post
  #4  
Old August 15th, 2001, 11:36 AM
knighthawk's Avatar
knighthawk knighthawk is offline
Registered User
 
Join Date: Jul 2001
Location: Los Angeles, CA
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
knighthawk is on a distinguished road
I laid in bed the other night (not able to sleep) trying to figure out why the code I wrote for the progess bar wasn't working the way I expected it to. That night I came up with this solution instead...

<pre>
[ProgessBar setDoubleValue:0.0];
[ProgessBar displayIfNeeded];

for( p = 0; p < 40; p++)
{
for( i = 0; i < ( iters / 40 ); i++)
{
MatTwoPowModM (A1p0, B1, m1, 1);
MatTwoPowModM (A2p0, B2, m2, 1);
}

[ProgessBar incrementBy:2.5];
[ProgessBar displayIfNeeded];

} // end for: each iteration
</pre>

It the progress bar increments every 250,000 calculations now. The nice thing is that if the "iters" number changes, the progress bar and the loop all work proportionally together. Even though it is only incremented 40 times, without the "displayIfNeeded" the progress bar will not show up. I kinda wish there was a way to turn off the animation for this type of progress bar, but the method for animation only seems to apply to the indeterminate progress bar.

I will look into the multi-threading part. I don't know if I will understand it though, only been programming in C for two months. And only been programming at all (REALbasic) for four months. (I switched to C from REALbasic because the programs I wanted to write we more complicated and required faster processing than REALbasic could handle). I don't understand the math of the code that you wrote. I don't understand structures at all. I am still terrible with strings! My first programming class (C/C++) starts tonight at the local JC.

One more question: what exactly is a gigaflop and does that relate to the math in this calculation?
Reply With Quote