Coder's Guild Mailing List

Re: Conversion

Posted by James Durbin on 1999-05-10

Luke Jordan wrote:
> return it in its decimal form. That's really easy, but the hard part was
> that if the fraction had repeating digits, you had to put them in brackets,
> e.g.:
> 1/3 = 0.3333333 = 0.(3).
> This brackets bit has me completely stumped. Any ideas?

The only way I can think of doing this is to use long division, and
checking for duplicates...  I've decided to make myself a function in
C++ to do this just for the hell of it. :)  I'll gladly give out the
source to anyone that wants it.  (when I get finnished with it of
course. :) ) 

/*
From:  James H. Durbin
Email: divine-bovine@xxxx.xxx
*/