Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-13 Thread jaladhi dave
Won't we require to check recurring till at-least two complete iterations of recurrence pattern. Also what's the division logic are we going to use ? In all modern day processor systems, we are likely to have a math co/sub-processor which will efficiently crunch numbers and round them off to our d

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-12 Thread divya jain
thanks anurag :) On 12 June 2010 20:07, Anurag Sharma wrote: > Since we are given numerator 'n' and denominator 'd' separately already. > and considering n and d as integers and d!=0 we can safely assume n/d as > either a terminating fraction or a non terminating but recurring fraction, > in whi

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-12 Thread Anurag Sharma
Since we are given numerator 'n' and denominator 'd' separately already. and considering n and d as integers and d!=0 we can safely assume n/d as either a terminating fraction or a non terminating but recurring fraction, in which case we have to find the recurring digits of the fraction. Now what

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-12 Thread divya jain
@anurag i dint get ur approach..which numerator n denominator u r talking about..plz explain.. thanks in advance On 11 June 2010 08:57, Anurag Sharma wrote: > Please note that the fractional repeating part is recurring. and so that > 4th temporary variable assignment will be this way-> > temp=x

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-11 Thread Anurag Sharma
Please note that the fractional repeating part is recurring. and so that 4th temporary variable assignment will be this way-> temp=x*1 - x= 233456.34563456... - 23.34563456 = 233433.0 ( mark the fractional part is 0 now since the infinitely repeating 3456... will get cancelled) In this c

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-11 Thread Ravi Thati
One solution that is very simple is: while doing division keep storing the dividend. if any one dividend is repeated stop there and extract the part between first occurrence digit before new occurrence. Example: 7/9 7) 9 (1.*285714*28 7 -- 20 14 ---

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-11 Thread nisha goyal
it will work as the number after the decimal digit is recurring as in this case 3456 is recurring that is the the number is not just 23.34563456, its 23.3456345634563456.. so after subtraction it will give zero as the decimal part. On Thu, Jun 10, 2010 at 8:55 AM, Veer Sharma wrote: > See

[algogeeks] Re: identify the recurring part for a given decimal no

2010-06-10 Thread Veer Sharma
Seems it wont work... x=23.34563456 temp = x*100 -x = 233.4563456 - 23.34563456 = 210.11071104 temp = x*100 -x = 2334.563456 - 23.34563456 = 2311.21782144 temp = x*1000 -x = 23345.63456 - 23.34563456 = 23322.28892544 temp = x*1 -x = 233456.3456 - 23.34563456 = 233432.6544 temp = x*10

Re: [algogeeks] Re: identify the recurring part for a given decimal no

2010-06-09 Thread Anurag Sharma
multiply the original number x=23.34563456 Anurag Sharma On Wed, Jun 9, 2010 at 10:36 PM, Veer Sharma wrote: > One question: > > No x = 23.34563456 > temp = x X 10 = 233.4563456 > temp = temp - x = 210.11071104 > decimal part zero? No. > Now multiply the no. with 100. Which no? original x (= 23.

[algogeeks] Re: identify the recurring part for a given decimal no

2010-06-09 Thread Veer Sharma
One question: No x = 23.34563456 temp = x X 10 = 233.4563456 temp = temp - x = 210.11071104 decimal part zero? No. Now multiply the no. with 100. Which no? original x (= 23.34563456) or new no. temp (=210.11071104)? On Jun 9, 8:12 pm, divya jain wrote: > multiply the no. with 10 nd store in tem