Commit 5254a34a authored by Jukka-Pekka Iivonen's avatar Jukka-Pekka Iivonen Committed by jpekka

Fixed frequency 1.

2001-10-09  Jukka-Pekka Iivonen  <jiivonen@hutcs.cs.hut.fi>

	* fn-financial.c (coupdays): Fixed frequency 1.
parent 008400fa
Gnumeric 0.72
Jukka:
* Improved COUPDAYS().
--------------------------------------------------------------------------
Gnumeric 0.71
......
......@@ -228,41 +228,55 @@ coupdays (GDate *settlement, GDate *maturity, int freq, int basis)
if (freq == 1) {
if (g_date_is_leap_year (sy)) {
if (sm == 1 || sm == 2) {
if (sm < mm || (sm == mm && sd < md))
return 365.0;
if (sm <= 2) {
if (mm <= 2) {
if (sm < mm ||
(sm == mm && sd < md))
return 365.0;
else
return 366.0;
}
return 366.0;
}
if (mm <= 2) {
if (mm == 2 && md >= 28)
return 365.0;
else
return 366.0;
}
if (mm == 1 || mm == 2)
return 366.0;
if (sm < mm || (sm == mm && sd < md))
return 366.0;
else
return 365.0;
} else if (g_date_is_leap_year (sy-1)) {
if (sm == 1 || sm == 2)
if (mm == 1 || mm == 2)
if (sm < mm ||
if (sm <= 2)
if (mm <= 2)
if (sm < mm ||
(sm == mm && sd < md))
return 366.0;
else
return 365.0;
else
return 365.0;
else
return 365.0;
else
return 365.0;
} else if (g_date_is_leap_year (sy+1)) {
if (sm == 1 || sm == 2)
return 365.0;
if (mm == 1 || mm == 2)
if (sm <= 2)
return 365.0;
if (mm <= 2)
return 365.0;
if (sm < mm || (sm == mm && sd < md))
return 365.0;
return 365.0;
else
return 366.0;
} else
return 365.0;
} else if (freq == 2) {
return -1.0;
} else {
/* Frequency 4 */
return -1.0;
}
default:
return -1.0;
......
2001-10-09 Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
* fn-financial.c (coupdays): Fixed frequency 1.
2001-10-07 Jody Goldberg <jgoldberg@home.com>
* Release 0.71
......@@ -7,6 +11,11 @@
* fn-database.c (find_cells_that_match) : Be less stupid.
(find_rows_that_match) : ditto.
2001-10-03 Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
* fn-financial.c (coupnum): Fixed frequency 2 and 4. Now it can
pass quite extensive test suite.
2001-09-30 Jody Goldberg <jgoldberg@home.com>
* fn-information.c (gnumeric_cell) : implement CELL(protected
......
......@@ -228,41 +228,55 @@ coupdays (GDate *settlement, GDate *maturity, int freq, int basis)
if (freq == 1) {
if (g_date_is_leap_year (sy)) {
if (sm == 1 || sm == 2) {
if (sm < mm || (sm == mm && sd < md))
return 365.0;
if (sm <= 2) {
if (mm <= 2) {
if (sm < mm ||
(sm == mm && sd < md))
return 365.0;
else
return 366.0;
}
return 366.0;
}
if (mm <= 2) {
if (mm == 2 && md >= 28)
return 365.0;
else
return 366.0;
}
if (mm == 1 || mm == 2)
return 366.0;
if (sm < mm || (sm == mm && sd < md))
return 366.0;
else
return 365.0;
} else if (g_date_is_leap_year (sy-1)) {
if (sm == 1 || sm == 2)
if (mm == 1 || mm == 2)
if (sm < mm ||
if (sm <= 2)
if (mm <= 2)
if (sm < mm ||
(sm == mm && sd < md))
return 366.0;
else
return 365.0;
else
return 365.0;
else
return 365.0;
else
return 365.0;
} else if (g_date_is_leap_year (sy+1)) {
if (sm == 1 || sm == 2)
return 365.0;
if (mm == 1 || mm == 2)
if (sm <= 2)
return 365.0;
if (mm <= 2)
return 365.0;
if (sm < mm || (sm == mm && sd < md))
return 365.0;
return 365.0;
else
return 366.0;
} else
return 365.0;
} else if (freq == 2) {
return -1.0;
} else {
/* Frequency 4 */
return -1.0;
}
default:
return -1.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment