fraction from the decimal value

# Thread: fraction from the decimal value

1. Senior Member
Join Date
Dec 1969
Posts
179

## fraction from the decimal value

How do I write out a fraction from a decimal value?

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## Use Response.Write <nm>

boo

3. Senior Member
Join Date
Dec 1969
Posts
16,931

## Easily? You can't.

There&#039;s a whole section of mathematics involved with this. One section&#039;s involved in examining PI. PI should, in theory, be a repeating decimal (i.e. representable by a fraction), but so far it&#039;s not.<BR><BR>You have to find if the decimal is fixed (as it will be if a user types it in).<BR><BR>For example, if the user types in "0.5", it is fixed at one decimal place. Therefore, you can multiply the decimal section by 10 to get 5. However, to represent the fact you&#039;ve multiplied by 10, you must have it divided by 10. So "5/10". However, you cannot implictly "cancel down" a fraction - you&#039;re going to have to write your own function to do that. You could do it using the MOD operator, but I&#039;m not going into that now.<BR><BR>Craig.

4. Senior Member
Join Date
Dec 1969
Posts
179

## RE: fraction from the decimal value

Please show a example.<BR>My value is from a DB:<BR>Response.Write rsTest("qty")

5. Senior Member
Join Date
Dec 1969
Posts
16,931

## Example?! Of what?!

Ghost&#039;s response was sarcastic, so there can&#039;t be an example with that...<BR><BR>Mine, I had an example.<BR><BR>Craig.

6. Senior Member
Join Date
Dec 1969
Posts
11,334

## Sarcastic? Moi?

Hmmm :)<BR><BR>Thought I was gonna write out:<BR><BR>Use the built in VBS function toFraction(). Has properties to set the Lowest Common Denomiator also :)<BR><BR>Woulda had him searching awhile for that.

7. Senior Member
Join Date
Dec 1969
Posts
16,931

## Lol

Shoulda done - would have been a laugh :)<BR><BR>Craig.

8. Senior Member
Join Date
Dec 1969
Posts
179

## Thanks

Thanks,<BR>And that would have been the last time time I ever came<BR>back to this site to ask for help or to learn something!

9. Senior Member
Join Date
Dec 1969
Posts
7,686

## Next time check the FAQs

and sites with asp info<BR><BR>http://www.4guysfromrolla.com/webtech/052401-1.shtml<BR><BR>maybe then you won&#039;t get a smart *** answer.

10. Senior Member
Join Date
Dec 1969
Posts
179

## Morning Gone

I spent my whole morning searching for answers to my questions before I swam with the sharks. I really enjoyed learning web design/prgramming but my only issue is that I run into a lot of big egos that like to make you feel real small because you are not as smart as they.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•