TADM2E 6.23
From Algorithm Wiki
The problem reduces to Floyd - Warshall algorithm if you take logs of all currency-exchange rates, as if a * b = c then ln(a) + ln(b) = ln(c).
In computational finance people often use logarithms of prices instead of prices themselves, as it gives faster calculations and makes it easy to apply log-normal distribution instead of normal distribution (log-normal distribution is more appropriate for asset prices).