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?
Printable View
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
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.
Search the post for 'fractions'. That should give you some ideas.