I've just hit something that seems to me very weird. I'd appreciate any thoughts.
The (tiny) problem is to calculate the interest due on a sum of common-law compensation - our client X paid certain sums over a period; the court has now agreed that they should not have been required to pay. OK, they get the money back - plus interest at R%. This represents the interest they would have earned if each payment had, at the time it was made, gone into a high-interest savings account. My first thought was that this was a future value calculation, so I used Excel - but I couldn't get sensible answers. Fine - write a tiny stack to do it iteratively. While I'm at it, I may as well allow for daily, weekly or monthly (28-day lunar) compounding periods (shouldn't really make much difference). I then display the amount of interest, and the effective annual interest rate R*. This is just the percentage increase of the basic compensation award, adjusted for the length of time - so we multiply by, for example (365 / <number of days>) - if the period is more than a year, this deflates the percentage increase to the effective annual rate and vice versa. The relevant bit of script is as follows:- set the numberFormat to "0.00" put "£" & (tCumInterest - tTotalAmount) into fld "InterestDue" put "£" & tCumInterest into fld "TotalAmount" put ((tCumInterest - tTotalAmount)/tTotalAmount) * 100 into tAnnRate if "Daily" is in gPeriod then put tAnnRate * 365/tDays into tAnnRate if "Weekly" is in gPeriod then put tAnnRate * 52/tDays into tAnnRate if "Monthly" is in gPeriod then put tAnnRate * 13/tDays into tAnnRate put tAnnRate & "%" into fld "OverallRate" -- I apologise for tdays - it is really "number of compounding periods" This works perfectly on a G4 Mac OS 9.3 in the IDE. I decided that it might be a useful gadget for people in the office, so I made a standalone for XP. It doesn't work - the effective interest rate is not adjusted for length of the period. This is not a problem with the pop-up menu - the standalone version knows elsewhere whether it is doing a daily, weekly or monthly calculation. The percentage increase tAnnRate is correct. Somehow the expressions "365/tDays" etc are evaluating to 1. But only in the standalone... Sorry to have gone on at such length, but I've had trouble believing what I'm seeing here. If anyone is interested, I'm sharing the stack in user area "jmr" as "Interest" (or words to that effect) - when the RunRev server is back up. I should emphasise that it's a standalone problem - it fails when compiled for Mac OS 9 as well as Windows. Are there known issues like this with the syntax of Transcript when compiled into a standalone? If so, I'd appreciate a pointer. Thanks John -- _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
