Re: Deriving decimal from fraction

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Your question doesn't make sense. You are correct in that a decimal is not
(necessarily) as accurate as a fraction, but a fraction derived from a
decimal will always be only as accurate as the decimal it was derived from.
For example, let's look at your example:

0.3333 = 1/3

This is incorrect. 0.3333 and 1/3 are 2 entirely different values. 1/3 is
greater than 0.3333. So, there is no way to derive 1/3 from 0.3333. You
*could* derive a fraction from it, but it would not be 1/3. In fact, you
could not derive 0.3333 from 1/3, as they are not equal. 1/3 cannot be
expressed in decimal numbers.

The formula is simple algebra. 1/3 is an expression that indicates 1 divided
by 3. So, let's start out with a fraction that *can* be converted to a
decimal:

0.25 = 1/4

This means that 0.25 is equal to 1 divided by 4. This could be expressed
using variables as:

x = y / z

From algebra, we know that to resolve for y, we use:

y = x * z

To resolve for z:

z = y / x

So, to derive 1 / 4 from 0.25, you would say:

0.25 = y / z

Now, it is important to note here that any number of fractions can be
derived from a decimal. For example:

0.25 = 1 / 4
0.25 = 2 / 8
0.25 = 3 / 12

So, all we have to do is plug in an arbitrary number into either the 'y' or
'z' variable to derive the other:

0.25 = 2 / z
2 / 0.25 = z
2 / .25 = 8
0.25 = 2 / 8

Of course, depending on what value you plug in, you may get a decimal or
fractional result for the other:

0.25 = 3 / z
3 / 0.25 = z
3 / 0.25 = 0.75
0.25 = 3 / 0.75

An easy fix is to use the original decimal, converted to a whole number, to
ensure a whole fraction:

0.25 = 25 / z
0.25 / 25 = z
0.25 / 25 = 100
0.25 = 25 / 100

If you want to, you can reduce the fraction, but I'm sure you know how to do
that.

In any case, as I said, you're not going to get any more accurate this way.
Because fractions *are* more accurate than decimals, you will never achieve
greater accuracy by converting a decimal to a fraction.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.


<arun.hallan@xxxxxxxxx> wrote in message
news:1152867589.401690.55470@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I need to derive fractions from decimals as so:

0.3333 = 1/3
0.6666 = 2/3

The decimal could also be 0.33, or 0.3333333 but the point is that it
that the fraction needs to be extracted.

The reason for this is a UI restriction, where users can only enter a
percentage. But in the case where a third needs to be expressed, a
decimal will never be as accurate as teh fraction.


Thanks,
Arun



.



Relevant Pages

  • Re: JSH: Keep it simple
    ... >>> algebraic integers contain all reals. ... >> which is 414/1000 without using the decimals, ... the decimal system is just a way to express a fraction. ... The mathematics is not human. ...
    (sci.math)
  • Re: Geometry package: fraction of an inch
    ... TeX reports the same value for 10.000005mm ... decimals. ... represented as _exact_ rational numbers, ... fraction "1bp" to the nearest sp. ...
    (comp.text.tex)
  • Re: The difference between two thousand and ones and two thousand one.
    ... >> Donna Richoux spake thusly: ... > place-value is routinely taught as a system (whether it is routinely ... Reading off decimals according to ... "One's a fraction and one's a decimal," you ...
    (alt.usage.english)
  • Re: JSH: Keep it simple
    ... >>> algebraic integers contain all reals. ... >> which is 414/1000 without using the decimals, ... > cannot be written as a fraction between two integers. ... the decimal system is just a short-cut way to express a fraction. ...
    (sci.math)
  • Deriving decimal from fraction
    ... I need to derive fractions from decimals as so: ... that the fraction needs to be extracted. ... decimal will never be as accurate as teh fraction. ...
    (microsoft.public.dotnet.languages.csharp)