Re: [algogeeks] Re: rise and fall of power

2011-10-05 Thread Piyush Kapoor
In which library do powl() and log10l() lie(they r not in cmath,i think) ,can anybody post a good reference to these..(I could not find much on googling) -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: rise and fall of power

2011-10-05 Thread Piyush Kapoor
Yes these are in cmath(or math.h) , /* 7.12.6.8 Double in C89 */ extern float __cdecl log10f (float); extern long double __cdecl log10l (long double); -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received

Re: [algogeeks] Re: rise and fall of power

2011-10-04 Thread amrit harry
we have to find X^N let it would be N YlogX=log(N) antiLog(YlogX)=N antilog for base 10 is power of 10 so 10^(YlogX)=N and if we want to find 3^5 pow(10,5log3)--- pow(10,2.3856062735)=243 and if u want to find first 2 digits pow(10,(2.3856062735-1))=24.3=24 On Tue, Oct 4, 2011 at 1:46 AM, sunny

Re: [algogeeks] Re: rise and fall of power

2011-10-04 Thread gaurav yadav
I am using following statements to print the first... scanf(%lf%lf,n,k); double v = n*log10(n); double dummy; double ff = modf(v,dummy); double val = floor(pow(10.0,ff+k-1)); printf(%.0f,val); this code works fine when for big values of n like n=234232

Re: [algogeeks] Re: rise and fall of power

2011-10-04 Thread gaurav yadav
nk 34 9: 117566389 23 8: 20880467 92 9: 466101087 1997: 2963208 234232 9: 943982129 3476566 9: 226270832 56999 9: 349261536 9 9:

Re: [algogeeks] Re: rise and fall of power

2011-10-04 Thread sunny agrawal
I also Faced the same problem when i tried this one and when i got to know the mistake it was not very happy :( Use methods powl and log10l instead of pow and log10 and u will get 9 digits of precision :) On Tue, Oct 4, 2011 at 10:21 PM, gaurav yadav gauravyadav1...@gmail.comwrote: n

Re: [algogeeks] Re: rise and fall of power

2011-10-03 Thread sunny agrawal
For Last K Gene has posted the right Approach. For First K Hint : Logarithms log(N^N) = NlgN On Tue, Oct 4, 2011 at 1:14 AM, Gene gene.ress...@gmail.com wrote: I have not done this, so I'm not sure. But there are some tricks. You can first break up the computation to exploit repeated