I have been adding greeks from the book to my index options spreadsheet.I have a minor technical question.In the second edition page 454 there is some Newton-Raphson IV code (shown below for convenience).Do you think the author may be checking for a lack of convergence by testing whether the price error ever increases between iterations? the test being Abs(cm - ci) <= minDiffIf so, I think there is a bug in the code.Since minDiff is always set to Abs(cm - ci) shortly before the while loop test executes, Abs(cm - ci) <= minDiff is always true.I checked the errata at
http://www.espenhaug.com/ and found no correction.I can correct the test for convergence.But I would like to make sure I am correctly guessing the intended functionality. Thanks.Public Function GImpliedVolatilityNR(CallPutFlag As String, S As Double, X _As Double, T As Double, r As Double, B As Double, cm As Double, epsilon As Double) Dim vi As Double, ci As Double Dim vegai As Double Dim minDiff As Double 'Manaster and Koehler seed value (vi) vi = Sqr(Abs(Log(S / X) + r * T) * 2 / T) ci = GBlackScholes(CallPutFlag, S, X, T, r, B, vi) vegai = GVega(S, X, T, r, B, vi) minDiff = Abs(cm - ci) While Abs(cm - ci) >= epsilon And Abs(cm - ci) <= minDiff vi = vi - (ci - cm) / vegai ci = GBlackScholes(CallPutFlag, S, X, T, r, B, vi) vegai = GVega(S, X, T, r, B, vi) minDiff = Abs(cm - ci) Wend If Abs(cm - ci) < epsilon Then GImpliedVolatilityNR = vi Else GImpliedVolatilityNR = "NA"End Function