Is there a function that can cancel down fractions as far as they go, and then return the denominator and the numerator as separate integers?
Is there a function that can cancel down fractions as far as they go, and then return the denominator and the numerator as separate integers?
Something along these lines?
http://www.google.com/search?q=great...on+denominator
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
yer, that kind of thing, but I was wondering if there was a specialised function for it or whether I would have to write my own function for it.
a/b reduces to a/gcd(a,b) / b/gcd(a,b)
Yes, you have to write gcd() for yourself (or find it).
Neither of which is particularly hard.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Search the post for 'fractions'. That should give you some ideas.