You complain that I rewrote it to add the implied operator, and then you rewrote yours to distribute? And not just that. You rewrote it to do each operation in 5 lines. What gave you the permission to write it out differently than it was written? What gave you permission to willy-nilly drop the rest of the term and distribute that 2. Write it like it is. All I did was write it out to add an operator that exists implicitly that the language requires.I understand what you're doing in code to make it work. The problem is you keep trying to code it and inserting an operator that doesn't exist to make it compile. Stop and write it out.
9/3/8/2(2+2)
Parenthesis aren't just replaced with a multiplication symbol.
X(A+B) = (X*A+X*B)
is the correct way to use it when there is no symbol preceding it. Right? There's no multiplication operator between the 2 and the '(' of the original statement?
You're shortcutting the property in a way that is attempting to drop the parenthesis, or remove the distribution, just to make the code compile. Which is not inherently wrong 99% of the time. If you were to distribute the full fraction, it'd look like
(2*9/3/8/2 + 2*9/3/8/2)
right? or if you want to solve 2+2 before distribution
(4*9/3/8/2)
Then you can eliminate the parenthesis as there's nothing left to perform on them. And I don't know about you, but that seems unnatural and definitely doesn't look right. I've never seen someone distribute a fraction into a grouping like that.
You can copy and paste the below into the Javascript console in your browser to test if you want. I also get 3/4 using your method, but 3/64 by hand when distributing only what I think is supposed to be, which is everything before the parenthesis excluding any operators.
Code:(function() { function jamil() { // evaluate 9 / 3 / 8 / 2 ( 2 + 2 ) // compute left to right just using multiply var x = 9; x /= 3; x /= 8; x /= 2; x *= (2 + 2); console.log("Jamil says the answer is " + x); return x; } function danimal() { // evaluate 9 / 3 / 8 / 2 ( 2 + 2 ) // distribute 1st available number pre-parenthesis, then compute var x = (2*2 + 2*2); var y = 9; y /= 3; y /= 8; y /= x; console.log("Danimal says the answer is " + y); return y; } jamil(); danimal(); })();
Honestly, I’m surprised we’re still talking about this. INGO has already resolved the right answer and we were in the irrelevant banter portion of the thread lifecycle.