JavaScript notation is |
|
(x2 + 2x - 1)5/3 | is Math.pow((x*x+2*x-1),5/3) |
---|---|
is Math.sqrt(Math.sin(x)/(Math.pow(2,x)+3*Math.log(x))) |
JavaScript expression |
x=7 y=1 |
x=7 y=-1 |
x=-7 y=1 |
x=-7 y=-1 |
comment |
---|---|---|---|---|---|
Simple Addition | |||||
x+y | 71 | 7-1 | -71 | -7-1 | fails |
(x+y) | 71 | 7-1 | -71 | -7-1 | fails |
eval(x)+eval(y) | 8 | 6 | -6 | -8 | works |
x+2*y-y | 71 | NaN | -73 | NaN | fails |
eval(x+y) | 71 | 6 | -71 | -8 | mixed results |
1*x+1*y | 8 | 6 | -6 | -8 | works |
x-(-y) | 8 | 6 | -6 | -8 | works |
s=0; s += x; s += y; |
071 | 07-1 | 0-71 | 0-7-1 | fails |
Other Binary Operations | |||||
x-y | 6 | 8 | -8 | -6 | works |
x*y | 7 | -7 | -7 | 7 | works |
x/y | 7 | -7 | -7 | 7 | works |