Fractions

This is more a math question then a programming one, but as I need to program it, I guess it's ok to post it here.

I need to make an addition of 2 fractions. That's just adding the two numerators, but when the denominators aren't the same, you need to find the least common denominator. But how to do that in a programming language?

Thanks
google least common denominator

Would it not just be easier, and faster, to times the two denominators together and then cancel down appropriately?

Anywho, I imagine this will help you: http://www.cplusplus.com/reference/clibrary/cmath/modf/
Thank you, I'll have a look at it.
That's what I indirectly suggested.
My bad ^^
Topic archived. No new replies allowed.