Commit db3d65b8 authored by Morten Welinder's avatar Morten Welinder
Browse files

Cleanups.

parent 7c19c6a7
1999-06-26 Morten Welinder <terra@diku.dk>
* src/fn-string.c (gnumeric_dollar): Avoid warning overflows.
* src/print-info.c (print_unit_new): Warning killer.
* src/fn-financial.c (calculate_fvif): Warning killer.
* src/expr.c (build_error_string): Re-remove.
* src/dialog-printer-setup.c (unit_into_to_points): Warning killer.
* src/mathfunc.c (MATHLIB_WARNING2, MATHLIB_WARNING4): Warning killer.
1999-07-01 Michael Meeks <michael@edenproject.org>
* src/main.c (gnumeric_main): Added excel_shutdown.
......
1999-06-26 Morten Welinder <terra@diku.dk>
* src/fn-string.c (gnumeric_dollar): Avoid warning overflows.
* src/print-info.c (print_unit_new): Warning killer.
* src/fn-financial.c (calculate_fvif): Warning killer.
* src/expr.c (build_error_string): Re-remove.
* src/dialog-printer-setup.c (unit_into_to_points): Warning killer.
* src/mathfunc.c (MATHLIB_WARNING2, MATHLIB_WARNING4): Warning killer.
1999-07-01 Michael Meeks <michael@edenproject.org>
* src/main.c (gnumeric_main): Added excel_shutdown.
......
1999-06-26 Morten Welinder <terra@diku.dk>
* src/fn-string.c (gnumeric_dollar): Avoid warning overflows.
* src/print-info.c (print_unit_new): Warning killer.
* src/fn-financial.c (calculate_fvif): Warning killer.
* src/expr.c (build_error_string): Re-remove.
* src/dialog-printer-setup.c (unit_into_to_points): Warning killer.
* src/mathfunc.c (MATHLIB_WARNING2, MATHLIB_WARNING4): Warning killer.
1999-07-01 Michael Meeks <michael@edenproject.org>
* src/main.c (gnumeric_main): Added excel_shutdown.
......
1999-06-26 Morten Welinder <terra@diku.dk>
* src/fn-string.c (gnumeric_dollar): Avoid warning overflows.
* src/print-info.c (print_unit_new): Warning killer.
* src/fn-financial.c (calculate_fvif): Warning killer.
* src/expr.c (build_error_string): Re-remove.
* src/dialog-printer-setup.c (unit_into_to_points): Warning killer.
* src/mathfunc.c (MATHLIB_WARNING2, MATHLIB_WARNING4): Warning killer.
1999-07-01 Michael Meeks <michael@edenproject.org>
* src/main.c (gnumeric_main): Added excel_shutdown.
......
......@@ -12,7 +12,7 @@ Gnumeric Spread Sheet task list
* Even More Functions
GROWTH, LINEST, LOGEST, PERCENTILE, MMULT, MDETERM,
QUARTILE, TREND, ERROR.TYPE.
QUARTILE, TREND.
(This is not a claim that these are all.)
......
1999-07-01 Morten Welinder <terra@diku.dk>
* boot.c: Clean out an incredible accumulation of #includes.
1999-07-01 Jody Goldberg <jgoldberg@home.com>
* formula-types.h : Add some missing ptg types.
* ms-excel-read.c : ms_excel_read_debug, ms_excel_formula_debug,
......
......@@ -5,20 +5,11 @@
* Michael Meeks (michael@imaginator.com)
**/
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <assert.h>
#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <gnome.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "main.h"
#include "sheet.h"
#include "file.h"
#include "excel.h"
......
......@@ -51,6 +51,7 @@ calculate_pvif (float_t rate, float_t nper)
return (pow (1+rate, nper));
}
#if 0
static float_t
calculate_fvif (float_t rate, float_t nper)
{
......@@ -62,6 +63,7 @@ calculate_pvifa (float_t rate, float_t nper)
{
return ((1.0 / rate) - (1.0 / (rate * pow (1+rate, nper))));
}
#endif
static float_t
calculate_fvifa (float_t rate, float_t nper)
......@@ -354,6 +356,21 @@ gnumeric_rate_f (float_t rate, float_t *y, void *user_data)
return GOAL_SEEK_ERROR;
}
/* The derivative of the above function with respect to rate. */
static GoalSeekStatus
gnumeric_rate_df (float_t rate, float_t *y, void *user_data)
{
if (rate > -1.0 && rate != 0.0) {
gnumeric_rate_t *data = user_data;
*y = -data->pmt * calculate_fvifa (rate, data->nper) / rate +
calculate_pvif (rate, data->nper - 1) * data->nper *
(data->pv + data->pmt * (data->type + 1 / rate));
return GOAL_SEEK_OK;
} else
return GOAL_SEEK_ERROR;
}
static Value *
gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
......@@ -397,7 +414,7 @@ gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
printf ("Guess = %.15g\n", rate0);
#endif
goal_seek_initialise (&data);
status = goal_seek_newton (&gnumeric_rate_f, NULL,
status = goal_seek_newton (&gnumeric_rate_f, &gnumeric_rate_df,
&data, &udata, rate0);
if (status == GOAL_SEEK_OK) {
#if 0
......
......@@ -819,9 +819,13 @@ gnumeric_dollar (FunctionEvalInfo *ei, Value **argv)
Value *v, *ag [3];
guint len, neg;
gchar *s;
static int barfed = 0;
g_warning ("GNUMERIC_DOLLAR is broken, it should use the "
"format_value routine");
if (!barfed) {
g_warning ("GNUMERIC_DOLLAR is broken, it should use the "
"format_value routine");
barfed = 1;
}
ag[0] = argv [0];
ag[1] = argv [1];
ag[2] = NULL;
......
......@@ -64,13 +64,17 @@ typedef struct {
GtkWidget *icon_dr;
} dialog_print_info_t;
static void fetch_settings (dialog_print_info_t *dpi);
#if 0
static double
unit_into_to_points (UnitInfo *ui)
{
return unit_convert (ui->value, ui->unit, UNIT_POINTS);
}
#endif
static GtkWidget *
load_image (const char *name)
......
......@@ -64,13 +64,17 @@ typedef struct {
GtkWidget *icon_dr;
} dialog_print_info_t;
static void fetch_settings (dialog_print_info_t *dpi);
#if 0
static double
unit_into_to_points (UnitInfo *ui)
{
return unit_convert (ui->value, ui->unit, UNIT_POINTS);
}
#endif
static GtkWidget *
load_image (const char *name)
......
......@@ -1947,32 +1947,6 @@ expr_decode_tree (ExprTree *tree, const EvalPosition *fp)
}
static ExprTree *
build_error_string (const char *txt)
{
ExprTree *val, *call;
Symbol *func;
val = g_new (ExprTree, 1);
val->oper = OPER_CONSTANT;
val->ref_count = 1;
val->u.constant = value_new_string (txt);
func = symbol_lookup (global_symbol_table, "ERROR");
if (func == NULL) {
g_assert_not_reached ();
return val;
}
call = g_new (ExprTree, 1);
call->oper = OPER_FUNCALL;
call->ref_count = 1;
symbol_ref ((call->u.function.symbol = func));
call->u.function.arg_list = g_list_prepend (NULL, val);
return call;
}
struct expr_tree_frob_references {
Sheet *src_sheet;
int src_col, src_row;
......
......@@ -51,6 +51,7 @@ calculate_pvif (float_t rate, float_t nper)
return (pow (1+rate, nper));
}
#if 0
static float_t
calculate_fvif (float_t rate, float_t nper)
{
......@@ -62,6 +63,7 @@ calculate_pvifa (float_t rate, float_t nper)
{
return ((1.0 / rate) - (1.0 / (rate * pow (1+rate, nper))));
}
#endif
static float_t
calculate_fvifa (float_t rate, float_t nper)
......@@ -354,6 +356,21 @@ gnumeric_rate_f (float_t rate, float_t *y, void *user_data)
return GOAL_SEEK_ERROR;
}
/* The derivative of the above function with respect to rate. */
static GoalSeekStatus
gnumeric_rate_df (float_t rate, float_t *y, void *user_data)
{
if (rate > -1.0 && rate != 0.0) {
gnumeric_rate_t *data = user_data;
*y = -data->pmt * calculate_fvifa (rate, data->nper) / rate +
calculate_pvif (rate, data->nper - 1) * data->nper *
(data->pv + data->pmt * (data->type + 1 / rate));
return GOAL_SEEK_OK;
} else
return GOAL_SEEK_ERROR;
}
static Value *
gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
......@@ -397,7 +414,7 @@ gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
printf ("Guess = %.15g\n", rate0);
#endif
goal_seek_initialise (&data);
status = goal_seek_newton (&gnumeric_rate_f, NULL,
status = goal_seek_newton (&gnumeric_rate_f, &gnumeric_rate_df,
&data, &udata, rate0);
if (status == GOAL_SEEK_OK) {
#if 0
......
......@@ -819,9 +819,13 @@ gnumeric_dollar (FunctionEvalInfo *ei, Value **argv)
Value *v, *ag [3];
guint len, neg;
gchar *s;
static int barfed = 0;
g_warning ("GNUMERIC_DOLLAR is broken, it should use the "
"format_value routine");
if (!barfed) {
g_warning ("GNUMERIC_DOLLAR is broken, it should use the "
"format_value routine");
barfed = 1;
}
ag[0] = argv [0];
ag[1] = argv [1];
ag[2] = NULL;
......
......@@ -51,6 +51,7 @@ calculate_pvif (float_t rate, float_t nper)
return (pow (1+rate, nper));
}
#if 0
static float_t
calculate_fvif (float_t rate, float_t nper)
{
......@@ -62,6 +63,7 @@ calculate_pvifa (float_t rate, float_t nper)
{
return ((1.0 / rate) - (1.0 / (rate * pow (1+rate, nper))));
}
#endif
static float_t
calculate_fvifa (float_t rate, float_t nper)
......@@ -354,6 +356,21 @@ gnumeric_rate_f (float_t rate, float_t *y, void *user_data)
return GOAL_SEEK_ERROR;
}
/* The derivative of the above function with respect to rate. */
static GoalSeekStatus
gnumeric_rate_df (float_t rate, float_t *y, void *user_data)
{
if (rate > -1.0 && rate != 0.0) {
gnumeric_rate_t *data = user_data;
*y = -data->pmt * calculate_fvifa (rate, data->nper) / rate +
calculate_pvif (rate, data->nper - 1) * data->nper *
(data->pv + data->pmt * (data->type + 1 / rate));
return GOAL_SEEK_OK;
} else
return GOAL_SEEK_ERROR;
}
static Value *
gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
......@@ -397,7 +414,7 @@ gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
printf ("Guess = %.15g\n", rate0);
#endif
goal_seek_initialise (&data);
status = goal_seek_newton (&gnumeric_rate_f, NULL,
status = goal_seek_newton (&gnumeric_rate_f, &gnumeric_rate_df,
&data, &udata, rate0);
if (status == GOAL_SEEK_OK) {
#if 0
......
......@@ -819,9 +819,13 @@ gnumeric_dollar (FunctionEvalInfo *ei, Value **argv)
Value *v, *ag [3];
guint len, neg;
gchar *s;
static int barfed = 0;
g_warning ("GNUMERIC_DOLLAR is broken, it should use the "
"format_value routine");
if (!barfed) {
g_warning ("GNUMERIC_DOLLAR is broken, it should use the "
"format_value routine");
barfed = 1;
}
ag[0] = argv [0];
ag[1] = argv [1];
ag[2] = NULL;
......
......@@ -189,7 +189,7 @@ goal_seek_newton (GoalSeekFunction f, GoalSeekFunction df,
/*
* Seek a goal (root) using bisection methods.
*
* The supplied function must (should) be continously over the interval.
* The supplied function must (should) be continous over the interval.
*
* Caller must have located a positive and a negative point.
*
......
......@@ -51,8 +51,8 @@
#define ML_UNDERFLOW (DBL_EPSILON * DBL_EPSILON)
#define ML_VALID(_x) (!ISNAN (_x))
#define ML_ERROR(cause) /* Nothing */
#define MATHLIB_WARNING2 (void)
#define MATHLIB_WARNING4 (void)
#define MATHLIB_WARNING2(_f,_a,_b) do { (void)(_f); (void)(_a); (void)(_b); } while (0)
#define MATHLIB_WARNING4(_f,_a,_b,_c,_d) do { (void)(_f); (void)(_a); (void)(_b); (void)(_c); (void)(_c); } while (0)
#define fmin2(_x,_y) MIN(_x, _y)
#define imin2(_x,_y) MIN(_x, _y)
......
......@@ -51,6 +51,7 @@ print_info_free (PrintInformation *pi)
g_free (pi);
}
#if 0
static PrintUnit
print_unit_new (UnitName unit, double value)
{
......@@ -61,6 +62,7 @@ print_unit_new (UnitName unit, double value)
return u;
}
#endif
static void
load_margin (const char *str, PrintUnit *p, char *def)
......
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