• The checker is not checking for equivalent fractio

 

I would like to give some feedback about. From: https://checkio.org/mission/oil-pie/solve/

On test 4 of extras my code yields a fraction of 219096391762401/1721432812270561 yet the answer the code is looking for is 2.4183843043037004e+21/1.9001162276662057e+22. The decimal representation of each of these fractions is 0.12727559867 so I believe my code to be correct.

import fractions def add(x,y): # add two fractions [x[0],x[1]] and [y[0],y[1]] t=x[0]y[1]+y[0]x[1] b=x[1]y[1] c=fractions.gcd(b,t) t=t/c b=b/c return[t,b] def mul(x,y): # multiply two fractions [x[0],x[1]] and [y[0],y[1]] t=x[0]y[0] b=x[1]*y[1] c=fractions.gcd(b,t) t=t/c b=b/c return[t,b] def divide_pie(groups): x=[1,1] #whole pie k=groups k2=[abs(int(i)) for i in k] l=sum(k2) # the total number of bots for i in range(len(k)): if k[i]>0: x=add(x,[-k[i],l]) # if k[i] is positive we subtract off k[i]/l if k[i]<0: x=mul(x,[l+k[i],l]) # if k[i] is negative we subtract off the proper proportion

return x

HTTP_USER_AGENT:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36