We have an data object that contains:
1. $principle (Long) – Principle
2. $days (int) – Number of Days Interest
3. $basis (int) – Basis (how many days in a year)
4. $dailyInterest (Long) – Daily Interest
Average Rate = 100 * $basis * ( $dailyInterest/$days ) / $principle
What screwed us over for an hour? DATA TYPE!!!
$dailyInterest/$days is an integer division! Therefore 5/3 gave us 1, instead of 1.6666!
So, boys and girls…
MIND YOUR DATA TYPES!