ddavisqa / google-refine

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

Supporting floating-point division #350

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Import data with a numerical column.
2.Go to Edit Column >> Add Column Based on This Column
3.Enter (value/1000), for example. Only integer result is displayed.

What is the expected output? What do you see instead?
Normal floating division would result in 629735/1000 displaying a value of 
629.735. Current result is 629.

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

What operating system and browser are you using?
Windows XP/Firefox 3.6.15

Is this problem specific to the type of browser you're using or it happens
in all the browsers you tried?
All browsers.

Please provide any additional information below.

Original issue reported on code.google.com by susan.e....@gmail.com on 15 Mar 2011 at 8:43

GoogleCodeExporter commented 9 years ago
Choose Jython as expression language; and write:

return value/float(1000)

Or if you have a column named "2000".
return cells['2000']['value']/float(value)

Original comment by erjo...@gmail.com on 17 Mar 2011 at 9:37

GoogleCodeExporter commented 9 years ago
Susan, could you also try:

value/1000.0

Original comment by dfhu...@gmail.com on 19 Mar 2011 at 10:26

GoogleCodeExporter commented 9 years ago
Did those suggestions work for you?  If not, perhaps you could continue the 
conversation on the mailing list.

I don't think it's wise to change the default arithmetic data types at this 
point in the game (ie automatically promote integers to floating point 
numbers), so I'm going to close the bug report, but obviously you've got at 
least a couple of people who are willing to help.

Original comment by tfmorris on 21 Mar 2011 at 3:10