in reply to Fraction Cancelation

I would not rule out the possibility that straight forward floating point arithmetic is more "efficient" than any cancelation algorithm. Loss of precision could be a problem for large numbers and/or arrays. Alternating the multiplies and divides could help.
Bill

Replies are listed 'Best First'.
Re^2: Fraction Cancelation
by LanX (Saint) on Feb 24, 2016 at 19:11 UTC
    Good point.

    Sorting and alternating the arrays to keep the temporary product near 1 should help minimizing the error.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Re^2: Fraction Cancelation
by Laurent_R (Canon) on Feb 24, 2016 at 21:53 UTC
    It really depends on the purpose of the whole thing. For some uses, floating point arithmetic is probably just good enough, and may very well be the most efficient solution; for example, it would probably be just good enough is the final aim is to compute probabilities.

    For some others purposes, you may need accurate integer arithmetic.