Raised This Month: $ Target: $400
 0% 

Run time error 11: divide


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-14-2014 , 16:19   Re: Run time error 11: divide
Reply With Quote #1

It is simple math. You have multiplication and dividing in one expression. Just put some brackets () on the multiplication or in the dividing. Depends of what you want but in this case I think you should put the multiplication expression in the brackets.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-14-2014 , 23:15   Re: Run time error 11: divide
Reply With Quote #2

Quote:
Originally Posted by Flick3rR View Post
It is simple math. You have multiplication and dividing in one expression. Just put some brackets () on the multiplication or in the dividing. Depends of what you want but in this case I think you should put the multiplication expression in the brackets.
This should not be necessary. Order of operations is handled correctly by the compiler (afaik). In light of that, there is no difference between multiplying first or dividing first.

However, one major flaw here is that the variables are not floating point variables which will result in integer division. This is occasionally beneficial but not in this case. The sqrt() outputs a floating point value but "length" is not floating point.

The error is probably occurring from a division by zero.
__________________

Last edited by fysiks; 06-15-2014 at 22:11. Reason: typo
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