Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Why does it freaze?

Author
Message
Drakportalen
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: Sweden
Posted: 25th Mar 2003 11:10
My DBpro exe files sometimes freaze when it will preform some task, if any one can remember I was working on a fractions calculator and then I needed to find out if a number was prime or composite. I have a write a snippet now and I dont know the program just freaze when it should preform this task? the variable svar# is the number that I need to find out if its prime or not

www.drakportalen.dot.nu
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 25th Mar 2003 12:05
calculating primes with big numbers will cause a lapse in time.

If u can precalc it somehow for an important part of a game speed section persay.


or u havent added a sync or fast sync in your main loop

Drakportalen
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: Sweden
Posted: 25th Mar 2003 19:18
Yes but the problem is that it will freaze. If the variable is 15489267219279127 or 3 doesn't matter? Iam out of clue I tried to add fastsync at many places and tried different combinations but it still freazes its kind of hard to precalculate but I will think of how I could change it maybe its my computer...

www.drakportalen.dot.nu
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Mar 2003 01:19
You can a few problems with your code:
Remember that floating point is an approximation - that floating point comparison with zero is probably the main cause of your problems.
You have a piece of code 'and UN = 1>svar#'. What's that supposed to do?

Alternatively, here's a function you can use

Drakportalen
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: Sweden
Posted: 27th Mar 2003 23:02
Ok got to look in to this soon.. Alot of work to do at the moment... Your function looks good. Thanks for the help, if I use it I will give credit to you. The "and UN = 1>svar#" is to make sure that the factor is some where between svar# and 1 so the eqvation don't just run in to the endless . Like I said I will take a closer look at your code when I have time to code again. Thanks.

www.drakportalen.dot.nu

Login to post a reply

Server time is: 2024-09-20 01:00:13
Your offset time is: 2024-09-20 01:00:13