3 ms·
I can't quickly parse this in a way that makes 5.2 1 + (2 * 3) - (4 / 5) = 6.2 (PEMDAS) 1 + (2 * (3 - (4 / 5))) = 5.4 (greedy) (((1+2) * 3) - 4) /
by peeters 2y ago
I can't quickly parse this in a way that makes 5.2
1 + (2 * 3) - (4 / 5) = 6.2 (PEMDAS)
1 + (2 * (3 - (4 / 5))) = 5.4 (greedy)
(((1+2) * 3) - 4) / 5 = 0.4 (non-greedy)
Was it a typo or is it using some other grouping I don't understand?
- deleted 2y ago[deleted]
- Y_Y 2y agoTypo, I should have actually run the code! That macro doesn't have any fancy operator precedence rules, but you could certainly add them.