Hi Arun,
If you want a human to look at the number and intuitively know what the
amount is, think graphics. Humans do not natively understand numbers. We
have to be taught to think in terms of numbers. But our brains are actually
incredibly accurate computers, as exemplified by, for example, a figure
skater. The calculations required to maintain balance while perched on top
of a couple of pieces of metal while sliding across an ice surface and
performing leaps, twirls, and jumps, is something no computer can do.
What humans *do* understand is graphics. We see from the time we are born,
and learn to calculate by sight, how large things are, how far away they
are, etc. This is why pie charts are so popular. So, what about displaying a
pie chart, a graph, or some other visual representation of the number?
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
What You Seek Is What You Get.
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Sorry, i should have made myself clearer.
> And Kevin, i have a mathematically based computer science degree, and
> understand fractions!
>
> I am worknig on an old system. The UI allows percentages to be added.
> So if we have a number, say 1000000, and you want to represent 20%, you
> can enter 20%.
>
> But what if you want to enter a third?
>
> The only solution i can see is to write code to round numbers such as
> 0.3333 to a third.
>
> YES i know it's not accurate, and i know the difference between 0.3333
> and 1/3.
>
> I'm just asking if there is a better solution to this, in the same way
> as a human can look at 0.3333 and intuitively know that the value is
> around a third.
>
> Thanks
> Arun
>
> Rick Lones wrote:
>
>> (E-Mail Removed) wrote:
>> > 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.
>>
>> 0.3333 = 3333/10000
>> 0.6666 = 3333/5000
>>
>> The problem here is that both of your examples have a natural and
>> well-defined
>> fraction representation - it's just not the one you want.
>>
>> You are getting into AI ("read my mind") territory here I am afraid. I
>> think
>> that IF you really need an explicit numerator and denominator then you
>> will need
>> to change the UI to accept them in that form. (And the program to work
>> with
>> them in that form as well, of course.) You will never get an exact
>> representation of 1/3 in floating point. What is driving this
>> requirement for
>> an exact representation? An education-based app of some kind?
>>
>> -rick-
>