Fractions

Jul 7, 2009 at 2:16pm
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
Jul 7, 2009 at 2:54pm
google least common denominator

Jul 7, 2009 at 4:31pm
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/
Jul 7, 2009 at 5:45pm
Thank you, I'll have a look at it.
Jul 7, 2009 at 6:48pm
That's what I indirectly suggested.
Jul 7, 2009 at 7:11pm
My bad ^^
Topic archived. No new replies allowed.