# Why risk-free interest is needed for Margrabe's Formula?

The source code for Margarble's formula in QuantLib is here. The implementation requires a forward price be computed:

    Real forward1 = process1_->stateVariable()->value() *
dividendDiscount1 / riskFreeDiscount;
Real forward2 = process2_->stateVariable()->value() *
dividendDiscount2 / riskFreeDiscount;


Why do we have to calculate the forward price? Margrable's formula explicity states that risk-free interest rate is not assumed because we can price the option under a stock measure. The formula in the original paper and wikipedia doesn't require it.

    Real d1 = (std::log((quantity1*forward1)/(quantity2*forward2))
+ 0.5*variance) / stdDev;


If one of the dividends is zero, we would get into a situation of log(0). Where do the extra terms that not shown come from?