summaryrefslogtreecommitdiffstats
path: root/straight_line_loan.c
diff options
context:
space:
mode:
Diffstat (limited to 'straight_line_loan.c')
-rw-r--r--straight_line_loan.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/straight_line_loan.c b/straight_line_loan.c
index 024fd49..1f6660c 100644
--- a/straight_line_loan.c
+++ b/straight_line_loan.c
@@ -1,8 +1,10 @@
#include "loans.h"
contract *sl_init(int n, int d, double r, double P) {
- if ((n < 0)) return NULL;
- if ((d >= n)||(d < 0)) return NULL;
+ if ((n < 0))
+ return NULL;
+ if ((d >= n) || (d < 0))
+ return NULL;
contract *c = (contract *)calloc(1, sizeof(contract));
c->n = (unsigned int)n;
c->d = (unsigned int)d;
@@ -16,7 +18,8 @@ double sl_update(contract *c) {
if (c->k > c->n)
return 0.0;
- if (c->k == c->d) c->D = c->P/(double)(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;
@@ -31,6 +34,4 @@ double sl_update(contract *c) {
return c->A;
}
-void sl_free(contract *c) {
- free(c);
-}
+void sl_free(contract *c) { free(c); }