-
Notifications
You must be signed in to change notification settings - Fork 190
Open
Description
openDog/Part11/Dog011/Dog011.ino
Line 391 in 98050a4
| hipAngle1 = atan(X / Z); // calc hip angle from vertical |
The check you have on Line 389, to avoid dividing by zero on Line 391 is incorrect. You are ensuring that the dividend (i.e. the number to be divided, X) is not zero, when you should be ensuring that the divisor (i.e. the number that divides the dividend, Z) is not zero.
Therefore the check should be to ensure that Z does not become zero. There is nothing wrong with the dividend (in this case X) becoming zero. As the X approaches zero, so does the value of the fraction - which is correct.
I note that Line 395 then uses the result of the hipHypotenuse, so it is this division that may need to be protected.
(Note: this error is made in multiple places)
Metadata
Metadata
Assignees
Labels
No labels