praneethgb / google-refine

Automatically exported from code.google.com/p/google-refine
Other
0 stars 0 forks source link

Evaluation precedence wrong for arithmetic expressions #415

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. Have any column.
2. Edit cells -> Transform..
3. Expression: 1-1-1

What is the expected output? What do you see instead?
Should always be calculated to "1". Instead preview shows "-1". Analogously 
"1-1+1" produces "-1". "1-1-1-1" produces "0".

What version of Google Refine are you using?
Version 2.0 [r1836]

What operating system and browser are you using?
Ubuntu 10.10 - the Maverick Meerkat,
Firefox 3.6.10

Is this problem specific to the type of browser you're using or it happens
in all the browsers you tried?
On a WinXP and Internet Explorer 7.0.5730.13 the same happens.

Please provide any additional information below.

Original issue reported on code.google.com by zaidouns...@googlemail.com on 23 Jun 2011 at 2:07

GoogleCodeExporter commented 8 years ago
For your first example, I think your values are backwards.  GREL gives 1 when 
it should give -1.

I'm not sure if the evaluation order is just backwards (ie right to left 
instead of left to right) or if it's more complicated than that.

Original comment by tfmorris on 23 Jun 2011 at 8:58

GoogleCodeExporter commented 8 years ago
Fixed in r2123. Both - and + were evaluating the right-hand side as a 
sub-expression instead of a simple term.

Original comment by tfmorris on 23 Jun 2011 at 11:44

GoogleCodeExporter commented 8 years ago

Original comment by tfmorris on 23 Jun 2011 at 11:45