According to My Calculations…

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!

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve this: Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.