Commit 864554f1 authored by Jody Goldberg's avatar Jody Goldberg

start cleaning the namespace

gnum_float -> gnm_float
parent eadd423e
This diff is collapsed.
......@@ -2596,7 +2596,7 @@ biff_get_rk (guint8 const *ptr)
case eIEEEx100:
{
guint8 tmp[8];
gnum_float answer;
gnm_float answer;
int lp;
/* Think carefully about big/little endian issues before
......@@ -2606,7 +2606,7 @@ biff_get_rk (guint8 const *ptr)
tmp[lp] = 0;
}
answer = (gnum_float)gsf_le_get_double (tmp);
answer = (gnm_float)gsf_le_get_double (tmp);
return value_new_float (type == eIEEEx100 ? answer / 100 : answer);
}
case eInt:
......@@ -2616,7 +2616,7 @@ biff_get_rk (guint8 const *ptr)
if ((number % 100) == 0)
return value_new_int (number / 100);
else
return value_new_float ((gnum_float)number / 100);
return value_new_float ((gnm_float)number / 100);
}
while (1) abort ();
}
......
......@@ -2179,7 +2179,7 @@ excel_write_value (ExcelWriteState *ewb, Value *v, guint32 col, guint32 row, gui
break;
}
case VALUE_FLOAT: {
gnum_float val = v->v_float.val;
gnm_float val = v->v_float.val;
gboolean is_int = ((val - (int)val) == 0.0) &&
(((((int)val)<<2)>>2) == ((int)val));
......
......@@ -71,7 +71,7 @@
***********************************************************************/
static inline void
gsl_complex_mul_imag (const complex_t *a, gnum_float y, complex_t *res)
gsl_complex_mul_imag (const complex_t *a, gnm_float y, complex_t *res)
{ /* z=a*iy */
complex_init (res, -y * GSL_IMAG (a), y * GSL_REAL (a));
}
......@@ -79,7 +79,7 @@ gsl_complex_mul_imag (const complex_t *a, gnum_float y, complex_t *res)
void
gsl_complex_inverse (const complex_t *a, complex_t *res)
{ /* z=1/a */
gnum_float s = 1.0 / complex_mod (a);
gnm_float s = 1.0 / complex_mod (a);
complex_init (res, (GSL_REAL (a) * s) * s, -(GSL_IMAG (a) * s) * s);
}
......@@ -95,7 +95,7 @@ gsl_complex_negative (const complex_t *a, complex_t *res)
**********************************************************************/
static void
gsl_complex_arcsin_real (gnum_float a, complex_t *res)
gsl_complex_arcsin_real (gnm_float a, complex_t *res)
{ /* z = arcsin(a) */
if (gnumabs (a) <= 1.0) {
complex_init (res, asingnum (a), 0.0);
......@@ -111,39 +111,39 @@ gsl_complex_arcsin_real (gnum_float a, complex_t *res)
void
gsl_complex_arcsin (const complex_t *a, complex_t *res)
{ /* z = arcsin(a) */
gnum_float R = GSL_REAL (a), I = GSL_IMAG (a);
gnm_float R = GSL_REAL (a), I = GSL_IMAG (a);
if (I == 0) {
gsl_complex_arcsin_real (R, res);
} else {
gnum_float x = gnumabs (R), y = gnumabs (I);
gnum_float r = hypotgnum (x + 1, y);
gnum_float s = hypotgnum (x - 1, y);
gnum_float A = 0.5 * (r + s);
gnum_float B = x / A;
gnum_float y2 = y * y;
gnm_float x = gnumabs (R), y = gnumabs (I);
gnm_float r = hypotgnum (x + 1, y);
gnm_float s = hypotgnum (x - 1, y);
gnm_float A = 0.5 * (r + s);
gnm_float B = x / A;
gnm_float y2 = y * y;
gnum_float real, imag;
gnm_float real, imag;
const gnum_float A_crossover = 1.5, B_crossover = 0.6417;
const gnm_float A_crossover = 1.5, B_crossover = 0.6417;
if (B <= B_crossover) {
real = asingnum (B);
} else {
if (x <= 1) {
gnum_float D = 0.5 * (A + x) *
gnm_float D = 0.5 * (A + x) *
(y2 / (r + x + 1) + (s + (1 - x)));
real = atangnum (x / sqrtgnum (D));
} else {
gnum_float Apx = A + x;
gnum_float D = 0.5 * (Apx / (r + x + 1)
gnm_float Apx = A + x;
gnm_float D = 0.5 * (Apx / (r + x + 1)
+ Apx / (s + (x - 1)));
real = atangnum (x / (y * sqrtgnum (D)));
}
}
if (A <= A_crossover) {
gnum_float Am1;
gnm_float Am1;
if (x < 1) {
Am1 = 0.5 * (y2 / (r + (x + 1)) + y2 /
......@@ -164,7 +164,7 @@ gsl_complex_arcsin (const complex_t *a, complex_t *res)
}
static void
gsl_complex_arccos_real (gnum_float a, complex_t *res)
gsl_complex_arccos_real (gnm_float a, complex_t *res)
{ /* z = arccos(a) */
if (gnumabs (a) <= 1.0) {
complex_init (res, acosgnum (a), 0);
......@@ -180,40 +180,40 @@ gsl_complex_arccos_real (gnum_float a, complex_t *res)
void
gsl_complex_arccos (const complex_t *a, complex_t *res)
{ /* z = arccos(a) */
gnum_float R = GSL_REAL (a), I = GSL_IMAG (a);
gnm_float R = GSL_REAL (a), I = GSL_IMAG (a);
if (I == 0) {
gsl_complex_arccos_real (R, res);
} else {
gnum_float x = gnumabs (R);
gnum_float y = gnumabs (I);
gnum_float r = hypotgnum (x + 1, y);
gnum_float s = hypotgnum (x - 1, y);
gnum_float A = 0.5 * (r + s);
gnum_float B = x / A;
gnum_float y2 = y * y;
gnm_float x = gnumabs (R);
gnm_float y = gnumabs (I);
gnm_float r = hypotgnum (x + 1, y);
gnm_float s = hypotgnum (x - 1, y);
gnm_float A = 0.5 * (r + s);
gnm_float B = x / A;
gnm_float y2 = y * y;
gnum_float real, imag;
gnm_float real, imag;
const gnum_float A_crossover = 1.5;
const gnum_float B_crossover = 0.6417;
const gnm_float A_crossover = 1.5;
const gnm_float B_crossover = 0.6417;
if (B <= B_crossover) {
real = acosgnum (B);
} else {
if (x <= 1) {
gnum_float D = 0.5 * (A + x) *
gnm_float D = 0.5 * (A + x) *
(y2 / (r + x + 1) + (s + (1 - x)));
real = atangnum (sqrtgnum (D) / x);
} else {
gnum_float Apx = A + x;
gnum_float D = 0.5 * (Apx / (r + x + 1) + Apx /
gnm_float Apx = A + x;
gnm_float D = 0.5 * (Apx / (r + x + 1) + Apx /
(s + (x - 1)));
real = atangnum ((y * sqrtgnum (D)) / x);
}
}
if (A <= A_crossover) {
gnum_float Am1;
gnm_float Am1;
if (x < 1) {
Am1 = 0.5 * (y2 / (r + (x + 1)) + y2 /
......@@ -236,7 +236,7 @@ gsl_complex_arccos (const complex_t *a, complex_t *res)
void
gsl_complex_arctan (const complex_t *a, complex_t *res)
{ /* z = arctan(a) */
gnum_float R = GSL_REAL (a), I = GSL_IMAG (a);
gnm_float R = GSL_REAL (a), I = GSL_IMAG (a);
if (I == 0) {
complex_init (res, atangnum (R), 0);
......@@ -245,11 +245,11 @@ gsl_complex_arctan (const complex_t *a, complex_t *res)
* take into account cancellation errors, overflow, underflow
* etc. It would benefit from the Hull et al treatment. */
gnum_float r = hypotgnum (R, I);
gnm_float r = hypotgnum (R, I);
gnum_float imag;
gnm_float imag;
gnum_float u = 2 * I / (1 + r * r);
gnm_float u = 2 * I / (1 + r * r);
/* FIXME: the following cross-over should be optimized but 0.1
* seems to work ok */
......@@ -257,8 +257,8 @@ gsl_complex_arctan (const complex_t *a, complex_t *res)
if (gnumabs (u) < 0.1) {
imag = 0.25 * (log1pgnum (u) - log1pgnum (-u));
} else {
gnum_float A = hypotgnum (R, I + 1);
gnum_float B = hypotgnum (R, I - 1);
gnm_float A = hypotgnum (R, I + 1);
gnm_float B = hypotgnum (R, I - 1);
imag = 0.5 * loggnum (A / B);
}
if (R == 0) {
......@@ -309,7 +309,7 @@ gsl_complex_arccot (const complex_t *a, complex_t *res)
void
gsl_complex_sinh (const complex_t *a, complex_t *res)
{ /* z = sinh(a) */
gnum_float R = GSL_REAL (a), I = GSL_IMAG (a);
gnm_float R = GSL_REAL (a), I = GSL_IMAG (a);
complex_init (res, sinhgnum (R) * cosgnum (I), cosh (R) * singnum (I));
}
......@@ -317,7 +317,7 @@ gsl_complex_sinh (const complex_t *a, complex_t *res)
void
gsl_complex_cosh (const complex_t *a, complex_t *res)
{ /* z = cosh(a) */
gnum_float R = GSL_REAL (a), I = GSL_IMAG (a);
gnm_float R = GSL_REAL (a), I = GSL_IMAG (a);
complex_init (res, cosh (R) * cosgnum (I), sinhgnum (R) * singnum (I));
}
......@@ -325,20 +325,20 @@ gsl_complex_cosh (const complex_t *a, complex_t *res)
void
gsl_complex_tanh (const complex_t *a, complex_t *res)
{ /* z = tanh(a) */
gnum_float R = GSL_REAL (a), I = GSL_IMAG (a);
gnm_float R = GSL_REAL (a), I = GSL_IMAG (a);
if (gnumabs (R) < 1.0) {
gnum_float D =
gnm_float D =
powgnum (cosgnum (I), 2.0) +
powgnum (sinhgnum (R), 2.0);
complex_init (res, sinhgnum (R) * cosh (R) / D,
0.5 * singnum (2 * I) / D);
} else {
gnum_float D =
gnm_float D =
powgnum (cosgnum (I), 2.0) +
powgnum (sinhgnum (R), 2.0);
gnum_float F = 1 + powgnum (cosgnum (I) / sinhgnum (R), 2.0);
gnm_float F = 1 + powgnum (cosgnum (I) / sinhgnum (R), 2.0);
complex_init (res, 1.0 / (tanhgnum (R) * F),
0.5 * singnum (2 * I) / D);
......@@ -386,7 +386,7 @@ gsl_complex_arccosh (const complex_t *a, complex_t *res)
}
static void
gsl_complex_arctanh_real (gnum_float a, complex_t *res)
gsl_complex_arctanh_real (gnm_float a, complex_t *res)
{ /* z = arctanh(a) */
if (a > -1.0 && a < 1.0) {
complex_init (res, atanhgnum (a), 0);
......
......@@ -113,7 +113,7 @@ database_find_values (Sheet *sheet, Value *database,
{
GSList *cells, *current;
int cellcount, count;
gnum_float *res1 = NULL;
gnm_float *res1 = NULL;
Value **res2 = NULL;
void *res;
......@@ -123,7 +123,7 @@ database_find_values (Sheet *sheet, Value *database,
cellcount = g_slist_length (cells);
/* Allocate memory -- one extra to make sure we don't get NULL. */
if (floats)
res = res1 = g_new (gnum_float, cellcount + 1);
res = res1 = g_new (gnm_float, cellcount + 1);
else
res = res2 = g_new (Value *, cellcount + 1);
for (count = 0, current = cells; current; current = current->next) {
......@@ -162,8 +162,8 @@ database_float_range_function (FunctionEvalInfo *ei,
Sheet *sheet;
int count;
int err;
gnum_float *vals = NULL;
gnum_float fres;
gnm_float *vals = NULL;
gnm_float fres;
Value *res;
fieldno = find_column_of_field (ei->pos, database, field);
......
......@@ -141,7 +141,7 @@ static char const *help_unix2date = {
static Value *
gnumeric_unix2date (FunctionEvalInfo *ei, Value **argv)
{
gnum_float futime = value_get_as_float (argv [0]);
gnm_float futime = value_get_as_float (argv [0]);
time_t utime = (time_t)futime;
/* Check for overflow. */
......@@ -173,7 +173,7 @@ static char const *help_date2unix = {
static Value *
gnumeric_date2unix (FunctionEvalInfo *ei, Value **argv)
{
gnum_float fserial = value_get_as_float (argv [0]);
gnm_float fserial = value_get_as_float (argv [0]);
int serial = (int)fserial;
time_t utime = datetime_serial_to_timet (serial);
......@@ -503,7 +503,7 @@ static char const *help_time = {
static Value *
gnumeric_time (FunctionEvalInfo *ei, Value **argv)
{
gnum_float hours, minutes, seconds;
gnm_float hours, minutes, seconds;
hours = value_get_as_float (argv [0]);
minutes = value_get_as_float (argv [1]);
......@@ -534,7 +534,7 @@ static char const *help_timevalue = {
static Value *
gnumeric_timevalue (FunctionEvalInfo *ei, Value **argv)
{
gnum_float raw = datetime_value_to_serial_raw (argv[0]);
gnm_float raw = datetime_value_to_serial_raw (argv[0]);
return value_new_float (raw - (int)raw);
}
......@@ -822,8 +822,8 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
int day1, day2, month1, month2, year1, year2, result;
gboolean flipped;
gnum_float serial1 = datetime_value_to_serial (argv[0]);
gnum_float serial2 = datetime_value_to_serial (argv[1]);
gnm_float serial1 = datetime_value_to_serial (argv[0]);
gnm_float serial2 = datetime_value_to_serial (argv[1]);
int imethod = argv[2] ? value_get_as_int (argv[2]) : 0;
method = (imethod >= 0 && imethod <= METHOD_US_SANE)
......@@ -831,7 +831,7 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
: METHOD_EUROPE;
if ((flipped = (serial1 > serial2))) {
gnum_float tmp = serial1;
gnm_float tmp = serial1;
serial1 = serial2;
serial2 = tmp;
}
......
......@@ -55,7 +55,7 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
int max, places;
char *err, buffer[40];
const char *str;
gnum_float v, b10;
gnm_float v, b10;
int digit;
g_return_val_if_fail (src_base > 1 && src_base <= 36,
......@@ -439,7 +439,7 @@ static const char *help_besseli = {
static Value *
gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
{
gnum_float x, order;
gnm_float x, order;
x = value_get_as_float (argv[0]); /* value to evaluate I_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -476,7 +476,7 @@ static const char *help_besselk = {
static Value *
gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
{
gnum_float x, order;
gnm_float x, order;
x = value_get_as_float (argv[0]); /* value to evaluate K_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -669,15 +669,15 @@ static const char *help_convert = {
typedef struct {
const char *str;
gnum_float c;
gnm_float c;
} eng_convert_unit_t;
static gnum_float
static gnm_float
get_constant_of_unit(const eng_convert_unit_t units[],
const eng_convert_unit_t prefixes[],
const char *unit_name,
gnum_float *c, gnum_float *prefix)
gnm_float *c, gnm_float *prefix)
{
int i;
......@@ -711,9 +711,9 @@ static Value *
convert (const eng_convert_unit_t units[],
const eng_convert_unit_t prefixes[],
const char *from_unit, const char *to_unit,
gnum_float n, Value **v, const EvalPos *ep)
gnm_float n, Value **v, const EvalPos *ep)
{
gnum_float from_c, from_prefix, to_c, to_prefix;
gnm_float from_c, from_prefix, to_c, to_prefix;
if (get_constant_of_unit (units, prefixes, from_unit, &from_c,
&from_prefix)) {
......@@ -782,7 +782,7 @@ gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
#define one_T_to_ga 10000
/* Temperature constants */
const gnum_float C_K_offset = GNUM_const (273.15);
const gnm_float C_K_offset = GNUM_const (273.15);
/* Liquid measure constants */
#define one_tsp_to_tbs (GNUM_const (1.0) / 3)
......@@ -920,7 +920,7 @@ gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
{ NULL,0.0 }
};
gnum_float n;
gnm_float n;
const char *from_unit, *to_unit;
Value *v;
......@@ -1011,7 +1011,7 @@ static const char *help_erf = {
static Value *
gnumeric_erf (FunctionEvalInfo *ei, Value **argv)
{
gnum_float ans, lower, upper;
gnm_float ans, lower, upper;
lower = value_get_as_float (argv[0]);
ans = erfgnum (lower);
......@@ -1047,7 +1047,7 @@ static const char *help_erfc = {
static Value *
gnumeric_erfc (FunctionEvalInfo *ei, Value **argv)
{
gnum_float x;
gnm_float x;
x = value_get_as_float (argv[0]);
......
This diff is collapsed.
......@@ -150,7 +150,7 @@ GetDiffParam (GDate *nStartDate, GDate *nEndDate, gint nMode, gint *rYears,
}
static gnum_float
static gnm_float
GetYearFrac (GDate *nStartDate, GDate *nEndDate, gint nMode)
{
gint nYears, nDayDiff, nDaysInYear;
......@@ -158,19 +158,19 @@ GetYearFrac (GDate *nStartDate, GDate *nEndDate, gint nMode)
GetDiffParam ( nStartDate, nEndDate, nMode, &nYears, &nDayDiff,
&nDaysInYear );
return nYears + (gnum_float) nDayDiff / nDaysInYear;
return nYears + (gnm_float) nDayDiff / nDaysInYear;
}
static gnum_float
GetRmz ( gnum_float fZins, gnum_float fZzr, gnum_float fBw, gnum_float fZw,
static gnm_float
GetRmz ( gnm_float fZins, gnm_float fZzr, gnm_float fBw, gnm_float fZw,
gint nF )
{
gnum_float fRmz;
gnm_float fRmz;
if ( fZins == 0.0 )
fRmz = ( fBw + fZw ) / fZzr;
else {
gnum_float fTerm = powgnum ( 1.0 + fZins, fZzr );
gnm_float fTerm = powgnum ( 1.0 + fZins, fZzr );
if ( nF > 0 )
fRmz = ( fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins /
( 1.0 - 1.0 / fTerm ) ) / ( 1.0 + fZins );
......@@ -182,16 +182,16 @@ GetRmz ( gnum_float fZins, gnum_float fZzr, gnum_float fBw, gnum_float fZw,
return -fRmz;
}
static gnum_float
GetZw ( gnum_float fZins, gnum_float fZzr, gnum_float fRmz, gnum_float fBw,
static gnm_float
GetZw ( gnm_float fZins, gnm_float fZzr, gnm_float fRmz, gnm_float fBw,
gint nF )
{
gnum_float fZw;
gnm_float fZw;
if ( fZins == 0.0 )
fZw = fBw + fRmz * fZzr;
else {
gnum_float fTerm = powgnum ( 1.0 + fZins, fZzr );
gnm_float fTerm = powgnum ( 1.0 + fZins, fZzr );
if ( nF > 0 )
fZw = fBw * fTerm + fRmz * ( 1.0 + fZins ) *
( fTerm - 1.0 ) / fZins;
......@@ -202,17 +202,17 @@ GetZw ( gnum_float fZins, gnum_float fZzr, gnum_float fRmz, gnum_float fBw,
return -fZw;
}
static gnum_float
Duration (GDate *nSettle, GDate *nMat, gnum_float fCoup, gnum_float fYield,
gint nFreq, gint nBase, gnum_float fNumOfCoups)
static gnm_float
Duration (GDate *nSettle, GDate *nMat, gnm_float fCoup, gnm_float fYield,
gint nFreq, gint nBase, gnm_float fNumOfCoups)
{
/* gnum_float fYearfrac = GetYearFrac ( nSettle, nMat, nBase ); */
gnum_float fDur = 0.0;
gnum_float t, p = 0.0;
/* gnm_float fYearfrac = GetYearFrac ( nSettle, nMat, nBase ); */
gnm_float fDur = 0.0;
gnm_float t, p = 0.0;
const gnum_float f100 = 100.0;
const gnm_float f100 = 100.0;
fCoup *= f100 / (gnum_float) nFreq; /* fCoup is used as cash flow */
fCoup *= f100 / (gnm_float) nFreq; /* fCoup is used as cash flow */
fYield /= nFreq;
fYield += 1.0;
......@@ -227,7 +227,7 @@ Duration (GDate *nSettle, GDate *nMat, gnum_float fCoup, gnum_float fYield,
p += ( fCoup + f100 ) / powgnum ( fYield, fNumOfCoups );
fDur /= p;
fDur /= (gnum_float) nFreq;
fDur /= (gnm_float) nFreq;
return ( fDur );
}
......@@ -235,12 +235,12 @@ Duration (GDate *nSettle, GDate *nMat, gnum_float fCoup, gnum_float fYield,
/***************************************************************************/
Value *
get_amordegrc (gnum_float fCost, GDate *nDate, GDate *nFirstPer,
gnum_float fRestVal, gint nPer, gnum_float fRate,
get_amordegrc (gnm_float fCost, GDate *nDate, GDate *nFirstPer,
gnm_float fRestVal, gint nPer, gnm_float fRate,
gint nBase)
{
gint n;
gnum_float fAmorCoeff, fNRate, fRest, fUsePer;
gnm_float fAmorCoeff, fNRate, fRest, fUsePer;
#define Round(x,y) (floorgnum ((x) + 0.5))
......@@ -285,15 +285,15 @@ get_amordegrc (gnum_float fCost, GDate *nDate, GDate *nFirstPer,
/***************************************************************************/
Value *
get_amorlinc (gnum_float fCost, GDate *nDate, GDate *nFirstPer,
gnum_float fRestVal, gint nPer, gnum_float fRate, gint nBase)
get_amorlinc (gnm_float fCost, GDate *nDate, GDate *nFirstPer,
gnm_float fRestVal, gint nPer, gnm_float fRate, gint nBase)
{
gnum_float fOneRate = fCost * fRate;
gnum_float fCostDelta = fCost - fRestVal;
gnum_float f0Rate = GetYearFrac ( nDate, nFirstPer, nBase )
gnm_float fOneRate = fCost * fRate;
gnm_float fCostDelta = fCost - fRestVal;
gnm_float f0Rate = GetYearFrac ( nDate, nFirstPer, nBase )
* fRate * fCost;
gint nNumOfFullPeriods = (fCost - fRestVal - f0Rate) / fOneRate;
gnum_float result;
gnm_float result;
if ( nPer == 0 )
result = f0Rate;
......@@ -309,10 +309,10 @@ get_amorlinc (gnum_float fCost, GDate *nDate, GDate *nFirstPer,
/***************************************************************************/
Value * get_yielddisc (GDate *nSettle, GDate *nMat, gnum_float fPrice,
gnum_float fRedemp, gint nBase)
Value * get_yielddisc (GDate *nSettle, GDate *nMat, gnm_float fPrice,
gnm_float fRedemp, gint nBase)
{
gnum_float fRet = 1.0 - fPrice / fRedemp;
gnm_float fRet = 1.0 - fPrice / fRedemp;
/* FIXME: I think this is bogus stuff. */
fRet /= GetYearFrac ( nSettle, nMat, nBase );
......@@ -324,12 +324,12 @@ Value * get_yielddisc (GDate *nSettle, GDate *nMat, gnum_float fPrice,
/***************************************************************************/
Value * get_yieldmat (GDate *nSettle, GDate *nMat, GDate *nIssue,
gnum_float fRate, gnum_float fPrice, gint nBase)
gnm_float fRate, gnm_float fPrice, gint nBase)
{
gnum_float fIssMat = GetYearFrac ( nIssue, nMat, nBase );
gnum_float fIssSet = GetYearFrac ( nIssue, nSettle, nBase );
gnum_float fSetMat = GetYearFrac ( nSettle, nMat, nBase );
gnum_float y = 1.0 + fIssMat * fRate;
gnm_float fIssMat = GetYearFrac ( nIssue, nMat, nBase );
gnm_float fIssSet = GetYearFrac ( nIssue, nSettle, nBase );
gnm_float fSetMat = GetYearFrac ( nSettle, nMat, nBase );
gnm_float y = 1.0 + fIssMat * fRate;
y /= fPrice / 100.0 + fIssSet * fRate;
y--;
......@@ -341,14 +341,14 @@ Value * get_yieldmat (GDate *nSettle, GDate *nMat, GDate *nIssue,
/***************************************************************************/
Value * get_oddlprice (GDate *nSettle, GDate *nMat, GDate *nLastCoup,
gnum_float fRate, gnum_float fYield,
gnum_float fRedemp, gint nFreq, gint nBase)
gnm_float fRate, gnm_float fYield,
gnm_float fRedemp, gint nFreq, gint nBase)
{
gnum_float fDCi = GetYearFrac ( nLastCoup, nMat, nBase ) * nFreq;
gnum_float fDSCi = GetYearFrac ( nSettle, nMat, nBase ) * nFreq;
gnum_float fAi = GetYearFrac ( nLastCoup, nSettle, nBase ) * nFreq;
gnm_float fDCi = GetYearFrac ( nLastCoup, nMat, nBase ) * nFreq;
gnm_float fDSCi = GetYearFrac ( nSettle, nMat, nBase ) * nFreq;
gnm_float fAi = GetYearFrac ( nLastCoup, nSettle, nBase ) * nFreq;
gnum_float p = fRedemp + fDCi * 100.0 * fRate / nFreq;
gnm_float p = fRedemp + fDCi * 100.0 * fRate / nFreq;
p /= fDSCi * fYield / nFreq + 1.0;
p -= fAi * 100.0 * fRate / nFreq;
......@@ -358,15 +358,15 @@ Value * get_oddlprice (GDate *nSettle, GDate *nMat, GDate *nLastCoup,
/***************************************************************************/
Value * get_oddlyield (GDate *nSettle, GDate *nMat, GDate *nLastCoup,
gnum_float fRate, gnum_float fPrice,
gnum_float fRedemp, gint nFreq, gint nBase)
gnm_float fRate, gnm_float fPrice,
gnm_float fRedemp, gint nFreq, gint nBase)
{
gnum_float fDCi = GetYearFrac ( nLastCoup, nMat, nBase ) * nFreq;
gnum_float fDSCi = GetYearFrac ( nSettle, nMat, nBase ) * nFreq;
gnum_float fAi = GetYearFrac ( nLastCoup, nSettle, nBase ) *
gnm_float fDCi = GetYearFrac ( nLastCoup, nMat, nBase ) * nFreq;
gnm_float fDSCi = GetYearFrac ( nSettle, nMat, nBase ) * nFreq;
gnm_float fAi = GetYearFrac ( nLastCoup, nSettle, nBase ) *
nFreq;
gnum_float y = fRedemp + fDCi * 100.0 * fRate / nFreq;
gnm_float y = fRedemp + fDCi * 100.0 * fRate / nFreq;
y /= fPrice + fAi * 100.0 * fRate / nFreq;
y--;
y *= nFreq / fDSCi;
......@@ -376,9 +376,9 @@ Value * get_oddlyield (GDate *nSettle, GDate *nMat, GDate *nLastCoup,
/***************************************************************************/
Value * get_duration (GDate *nSettle, GDate *nMat, gnum_float fCoup,
gnum_float fYield, gint nFreq, gint nBase,
gnum_float fNumOfCoups)
Value * get_duration (GDate *nSettle, GDate *nMat, gnm_float fCoup,
gnm_float fYield, gint nFreq, gint nBase,
gnm_float fNumOfCoups)
{
return value_new_float ( Duration (nSettle, nMat, fCoup, fYield, nFreq,
nBase, fNumOfCoups) );
......@@ -386,24 +386,24 @@ Value * get_duration (GDate *nSettle, GDate *nMat, gnum_float fCoup,
/***************************************************************************/
Value * get_mduration (GDate *nSettle, GDate *nMat, gnum_float fCoup,
gnum_float fYield, gint nFreq, gint nBase,
gnum_float fNumOfCoups)
Value * get_mduration (GDate *nSettle, GDate *nMat, gnm_float fCoup,
gnm_float fYield, gint nFreq, gint nBase,
gnm_float fNumOfCoups)
{
gnum_float fRet = Duration (nSettle, nMat, fCoup, fYield, nFreq, nBase,
gnm_float fRet = Duration (nSettle, nMat, fCoup, fYield, nFreq, nBase,
fNumOfCoups);
fRet /= 1.0 + ( fYield / (gnum_float) nFreq );