Raised This Month: $ Target: $400
 0% 

Run time error 11: divide


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 06-14-2014 , 23:08   Re: Run time error 11: divide
Reply With Quote #1

I think it's because you're dividing by 0.
__________________
Black Rose is offline
Gasa
Senior Member
Join Date: Sep 2013
Old 06-15-2014 , 07:34   Re: Run time error 11: divide
Reply With Quote #2

Quote:
Originally Posted by Black Rose View Post
I think it's because you're dividing by 0.
You are right same error even with () .But if i check is lenght == 0 ,flame not working!

Last edited by Gasa; 06-15-2014 at 07:36.
Gasa is offline
Kiske
Veteran Member
Join Date: May 2009
Old 06-15-2014 , 21:35   Re: Run time error 11: divide
Reply With Quote #3

Quote:
Originally Posted by Gasa View Post
But if i check is lenght == 0 ,flame not working!
PHP Code:
velocityvec[0]=velocityvec[0]*speed/length
velocityvec
[1]=velocityvec[1]*speed/length
velocityvec
[2]=velocityvec[2]*speed/length 
->

PHP Code:
if(length != 0) {
    
velocityvec[0]=velocityvec[0]*speed/length
    velocityvec
[1]=velocityvec[1]*speed/length
    velocityvec
[2]=velocityvec[2]*speed/length
} else {
    
velocityvec[0]=velocityvec[0]*speed
    velocityvec
[1]=velocityvec[1]*speed
    velocityvec
[2]=velocityvec[2]*speed

__________________

Kiske is offline
Send a message via Skype™ to Kiske
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-15-2014 , 22:11   Re: Run time error 11: divide
Reply With Quote #4

Quote:
Originally Posted by Kiske View Post
PHP Code:
velocityvec[0]=velocityvec[0]*speed/length
velocityvec
[1]=velocityvec[1]*speed/length
velocityvec
[2]=velocityvec[2]*speed/length 
->

PHP Code:
if(length != 0) {
    
velocityvec[0]=velocityvec[0]*speed/length
    velocityvec
[1]=velocityvec[1]*speed/length
    velocityvec
[2]=velocityvec[2]*speed/length
} else {
    
velocityvec[0]=velocityvec[0]*speed
    velocityvec
[1]=velocityvec[1]*speed
    velocityvec
[2]=velocityvec[2]*speed

This is not a solution to the actual problem. The code needs to be re-written properly with floating point variables.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode