Re: A mysterious divide by 0 error

2016-05-22 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: A mysterious divide by 0 error

I'm unable to replicate this bug. Can you paste the code exactly as it appears? Going off of this though, I'd say your bug is somewhere else. That if statement should take care of any divide by 0 errors that come about unless some how the value of u changes mid-way through the script's execution.Also, makes sure u and dist are compatible variables for what you're wanting to do.

URL: http://forum.audiogames.net/viewtopic.php?pid=261359#p261359





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: A mysterious divide by 0 error

2016-05-21 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: A mysterious divide by 0 error

Hm, is dist a float? Maybe theres some rounding going on. You could also try changing it to less than as opposed to equal to:if(u!=0) u = u/((dist<1.0) ? 1 : dist);

URL: http://forum.audiogames.net/viewtopic.php?pid=261259#p261259





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: A mysterious divide by 0 error

2016-05-21 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: A mysterious divide by 0 error

Hm, well the division by zero usually only happens when dividing something by zero, in this case it should only apply to dist, not u. Is dist a float? Maybe theres some rounding going on. You could also try changing it to less than as opposed to equal to:if(u!=0) u = u/((dist<1.0) ? 1 : dist);

URL: http://forum.audiogames.net/viewtopic.php?pid=261259#p261259





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: A mysterious divide by 0 error

2016-05-21 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: A mysterious divide by 0 error

I've encountered similar errors before, usually going something like: SubDivisionError: integer division or modulo by zero. Generally its because your trying to divide a number by zero, so it'll throw a fit when dividing 1 by zero or dividing zero by zero, but not when dividing zero by one. You could probably put a check in place to see if u is equal to zero, then add 1 to it, or some other means of vetting the values before doing calculations.

URL: http://forum.audiogames.net/viewtopic.php?pid=261257#p261257





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector