diff options
Diffstat (limited to 'straight_line_loan.c')
| -rw-r--r-- | straight_line_loan.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/straight_line_loan.c b/straight_line_loan.c index df86dcc..024fd49 100644 --- a/straight_line_loan.c +++ b/straight_line_loan.c @@ -1,6 +1,6 @@ #include "loans.h" -contract *sl_init(int n, int d, float r, float P) { +contract *sl_init(int n, int d, double r, double P) { if ((n < 0)) return NULL; if ((d >= n)||(d < 0)) return NULL; contract *c = (contract *)calloc(1, sizeof(contract)); @@ -12,11 +12,11 @@ contract *sl_init(int n, int d, float r, float P) { return c; } -float sl_update(contract *c) { +double sl_update(contract *c) { if (c->k > c->n) - return 0.0f; + return 0.0; - if (c->k == c->d) c->D = c->P/(float)(c->n - c->k); + if (c->k == c->d) c->D = c->P/(double)(c->n - c->k); c->k++; c->I = c->r * c->P; |
