jsanjuancalleja / google-refine

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

Combin() function does not work as intended #517

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With Trunk,

What steps will reproduce the problem?
1. Transform with combin(60,6)

What is the expected output? What do you see instead?

Error: / by Zero in java.lang.arithmetic

Original issue reported on code.google.com by thadguidry on 12 Jan 2012 at 2:34

GoogleCodeExporter commented 9 years ago
The current implementation is limited to a maximum initial parameter value of 
12 (the max factorial that it can compute without overflowing).

I've added some error checking/reporting and slightly increased the dynamic 
range (it'll go up to 20 now) as a stopgap, but it needs a new algorithm.  
Something along the lines of 
http://introcs.cs.princeton.edu/java/96optimization/Binomial.java.html

Original comment by tfmorris on 12 Jan 2012 at 6:21

GoogleCodeExporter commented 9 years ago
Fixed in r2459.  Refine now knows that combin(60,6) is 50063860.  It should 
successfully compute any result which fits in a long.  The upper limit is near 
combin(66,33) =  7219428434016265740

The new limit is based on the size of the result, not solely the factorial of 
the first parameter (which it never computes, because it's using a different 
algorithm).

Original comment by tfmorris on 8 Mar 2012 at 10:56

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 18 Sep 2012 at 3:05