Your post would be less odd if you described what you are actually trying to accomplish, and especially why.
But since for now that post is all there is, I'll try to get into that mumbo jumbo:
Quote:
|
I know this is a rather odd post but I need to be able to convert a decimal to a fraction.
|
If that's all you want to do, that's quite easy. .5625 as a fraction is 5625/10000. If you want it in lowest terms, use the euclidian algorithm to compute the greatest common divisor.
Quote:
|
Really all i need to know to get what i have to work is being able to tell if a number is whole or not.
|
If that's all you want to know, that's quite easy too.
number == parseInt(number) will tell you if it's whole.
Quote:
For instance if i have an accuracy set of .0625 = 1/16"
If i take my variable which is set to .5625 (9/16")
so if i take variable/accuracy in this case would equal 9. So this way i would know that the numerator would be 9 and my denominator would be 16.
|
Don't know what you are doing there. You won't know your denominator would be 16; you put that information right into that calculation. You don't want to test all natural numbers just to find out the denominator, do you?
Quote:
|
If i take the same accuracy of 1/16 and now introduce a variable of 0.5 then it will give me a remainder.
|
What remainder are you talking about? It will give you 8.
Quote:
|
I think i'm getting all jumbled up, if anyone has any insight this would be great.
|
I'm afraid insight into your problem is exactly what I am lacking. Please provide.