Re: Precision issue in python

2010-02-20 Thread Shashwat Anand
@Mark, The str(...).split('.') here doesn't do a good job of extracting the > integer part when its argument is >= 1e12, since Python produces a > result in scientific notation. I think you're going to get strange > results when k >= 13. > Yeah, you were correct. I tested it for k >= 13, and the

Re: Precision issue in python

2010-02-20 Thread Mark Dickinson
On Sat, Feb 20, 2010 at 2:42 PM, Shashwat Anand wrote: > A quick solution I came out with, no stirling numbers and had tried to avoid > large integer multiplication as much as possible. > > import math > > for i in range(int(raw_input())): >     n, k, l = [int(i) for i in raw_input().split()] >   

Re: Precision issue in python

2010-02-20 Thread Mark Dickinson
On Feb 20, 3:37 pm, mukesh tiwari wrote: > I don't know if is possible to import this decimal module but kindly > tell me.Also a bit about log implementation The decimal module is part of the standard library; I don't know what the rules are for SPOJ, but you're already importing the math module

Re: Precision issue in python

2010-02-20 Thread Shashwat Anand
> I don't know if is possible to import this decimal module but kindly > tell me.Also a bit about log implementation > Why don't you read about decimal module (there is log too in it) and try writing your approach here in case it does not work? Or you insist someone to rewrite your code using decim

Re: Precision issue in python

2010-02-20 Thread mukesh tiwari
On Feb 20, 8:13 pm, mukesh tiwari wrote: > On Feb 20, 5:44 pm, Mark Dickinson wrote: > > > > > > > On Feb 20, 11:17 am, mukesh tiwari > > wrote: > > > > Hello everyone. I think it is  related to the precision with double > > > arithmetic so i posted here.I am trying with this problem > > > (htt

Re: Precision issue in python

2010-02-20 Thread mukesh tiwari
On Feb 20, 5:44 pm, Mark Dickinson wrote: > On Feb 20, 11:17 am, mukesh tiwari > wrote: > > > Hello everyone. I think it is  related to the precision with double > > arithmetic so i posted here.I am trying with this problem > > (https://www.spoj.pl/problems/CALCULAT) and the problem say that "No

Re: Precision issue in python

2010-02-20 Thread Shashwat Anand
A quick solution I came out with, no stirling numbers and had tried to avoid large integer multiplication as much as possible. import math for i in range(int(raw_input())): n, k, l = [int(i) for i in raw_input().split()] e = sum(math.log10(i) for i in range(1, n+1)) frac_e = e - math.

Re: Precision issue in python

2010-02-20 Thread Mark Dickinson
On Feb 20, 11:17 am, mukesh tiwari wrote: > Hello everyone. I think it is  related to the precision with double > arithmetic so i posted here.I am trying with this problem > (https://www.spoj.pl/problems/CALCULAT) and the problem say that "Note : for > all test cases whose N>=100, its K<=15." I k

Precision issue in python

2010-02-20 Thread mukesh tiwari
Hello everyone. I think it is related to the precision with double arithmetic so i posted here.I am trying with this problem (https:// www.spoj.pl/problems/CALCULAT) and the problem say that "Note : for all test cases whose N>=100, its K<=15." I know precision of doubles in c is 16 digits. Could s