RE: Bug in Price routine?



According to My HP 17b2+ financial calculator's documentation, the formula
for price if there is one or fewer (??) coupon period remaining is

Price=[(CALL+CPN%/M)/(1+(DSC/E*Y/M))]-(A/E*CPN%/M)

Where
A=Accrued days, the number of days from beginning of coupon period to
settlement date E=Number of days in coupon period bracketing settlement date
DSC= number of days from settlement to next coupon date. (DSC=E-A) M=number
of coupons per year Y=yield as a decimal fraction CALL=redemption value (I
suppose), CPN%=coupon rate (in percentage, for instance 3.0 instead of .003)

If there is more than 1 coupon remaining then the formula is the same as in
gnumeric.

They give as a reference "Lynch, John J., Jr and Jan H. Mayle, Standard
Securities Calculation Methods, Securities Industry Association, New York,
1986".


Note that yield formula in gnumeric is correct because it does have a
special case if there is only one coupon remaining.

Probably my suggested patch should read

    /* START OF PATCH */
     if   (n == 1)
          return    ((redemption + den)/(1.0+exponent*basem1)-a/e*den);
    /* END OF PATCH */

Also I believe it would be better (faster and more clear) to replace

d = coupdaysnc (settlement, maturity, conv);

with 

d = e-a;

- Philippe


-----Original Message-----
From: Morten Welinder [mailto:mwelinder gmail com]
Sent: Monday, 07 November, 2005 5:59 PM
To: Lelong, Philippe
Cc: gnumeric-list gnome org
Subject: Re: Bug in Price routine?

For these values, price returns 101.226114 in Excel and HP calculator, 
when gnumeric gives 101.230116.

My Excel gives "101.2226..."

Do you have a reference for this?  The formula we use is the claim that
Excel claims to use, but clearly does not.

Morten

-----Original Message-----
From: Morten Welinder [mailto:mwelinder gmail com] 
Sent: Monday, 07 November, 2005 5:59 PM
To: Lelong, Philippe
Cc: gnumeric-list gnome org
Subject: Re: Bug in Price routine?

For these values, price returns 101.226114 in Excel and HP calculator,
when
gnumeric gives 101.230116.

My Excel gives "101.2226..."

Do you have a reference for this?  The formula we use is the claim that
Excel claims to use, but clearly does not.

Morten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]