Raised This Month: $ Target: $400
 0% 

Run time error 11: divide


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kiske
Veteran Member
Join Date: May 2009
Old 06-15-2014 , 21:35   Re: Run time error 11: divide
Reply With Quote #1

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 #2

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