When writing an equation involving trigonometry, Inform appears to interpret sin/y as sin(x/y), although it should be (sin)/y.
Steps to reproduce :
Equation - The Equation WIthout Extra Parentheses
N1 = sin(b)/c
where N1 is a real number, b is a real number, and c is a real number.
Equation - The Equation With Extra Parentheses
N2 = (sin(b))/c
where N2 is a real number, b is a real number, and c is a real number.
When play begins:
let b be 3.14159;
let c be 4;
let N1 be given by the Equation Without Extra Parentheses;
let N2 be given by the Equation With Extra Parentheses;
say "Without extra parentheses, the answer is [N1].";
say "With extra parentheses, the answer is [N2]."
Lab is a room.
Additional information :
Output:
Without extra parentheses, the answer is 0.70711.
With extra parentheses, the answer is 6.33796 Ã 10^-7.
Note that the first output is root(2)/2, which is sin(pi/4), while the second output is approximately 0, which is sin(pi) divided by 4.
Graham has said that if we want the traditional order of mathematical operations we should use equations, but here even equations do not seem to guarantee the expected behavior.
Reported by : mattweiner
Description :
When writing an equation involving trigonometry, Inform appears to interpret sin/y as sin(x/y), although it should be (sin)/y.
Steps to reproduce :
Additional information :
Output:
Without extra parentheses, the answer is 0.70711.
With extra parentheses, the answer is 6.33796 Ã 10^-7.
Note that the first output is root(2)/2, which is sin(pi/4), while the second output is approximately 0, which is sin(pi) divided by 4.
Graham has said that if we want the traditional order of mathematical operations we should use equations, but here even equations do not seem to guarantee the expected behavior.
imported from: [Mantis 1922] order of trigonometry operations is wrong, even in an equation