Re: Making a decimal to fraction converter



The goal of the program is to convert decimals to fractions with only the input of a decimal number, and thus far, I've only been able to simplify nonrepeating decimal numbers. If I were to have the user specify the finest graduation, I'd need a drastically different code, and I'd be going beyond the goal of the program =\

Is my goal hopeless without specifying the finest graduation then?

-Jason
"Tom Dacon" <tdacon@xxxxxxxxxxxxxxxx> wrote in message news:ui4sIPNIJHA.3824@xxxxxxxxxxxxxxxxxxxxxxx
Jason, if you can have your users specify the finest graduation to output (say, 64ths, 8ths, quarters, etc.), or if you assume a certain finest graduation, you can convert a repeating fraction and then round to the finest graduation that the number converts to, and then reduce it if possible.

So for instance, your 1/3 is 0.33333... If your finest graduation is 128ths, multiply the 0.33333... by 128, getting 42.66666... and round to 43, giving youi 43 / 128ths.

Similarly, 1/9 is 0.11111... For 128ths, multiply 0.11111... by 128, getting 14.22222... Round to 14/128ths and reduce to 7/64ths.


Tom Dacon
Dacon Software Consulting

"Jason" <RomulanPrince@xxxxxxxxxxxx> wrote in message news:204A45ED-4C6D-43E6-AD43-BBCCA0F71073@xxxxxxxxxxxxxxxx
I'm making a program that will convert decimal inputs (in this case, in inches) and output a fractional answer. At the moment, I'm only able to output the fractional answer in three parts: A whole number text box, a numerator text box, and a denominator text box. I realize that this is probably the closest I'll get to having fractions displayed in VB, so that's no big deal. I'm able to simplify most numbers with some code I've written, but I'm unable to simplify anything that repeats infinitely (i.e.. 1/3). Is there any way to be able to simplify this?

I can give you the code I've already written if that would help.

Thanks!



.



Relevant Pages

  • Re: Abolish Fractions?
    ... rules for calculating with fractions, he might have a decimal point, ... that operations with decimals would make sense. ... Am I just missing the joke? ... really is a kook. ...
    (sci.math)
  • Re: Abolish Fractions?
    ... If he had only been proposing not to teach all children all of the ... rules for calculating with fractions, he might have a decimal point, ... that operations with decimals would make sense. ... Am I just missing the joke? ...
    (sci.math)
  • Re: devreden
    ... Apparently, high school texts don't ... in my high school algebra 1 text about converting repeating ... We knew from grade school long division that some fractions ... give rise to repeating decimals (and if this is all that you're ...
    (sci.math)
  • Re: Abolish Fractions?
    ... later math, and so needs to be taught _early_, as early as possible, ... decimals are boring -- there is no ... except the underlying depth of fractions. ... The quality of math literacy of elementary school teachers is so low, ...
    (sci.math)
  • Re: devreden
    ... Apparently, high school texts don't ... We knew from grade school long division that some fractions ... give rise to repeating decimals (and if this is all that you're ... using geometric series, but since this was a small rural school, ...
    (sci.math)

Loading