Quote:
Originally Posted by Flick3rR
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.
__________________