Commit 4661eea5 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Correct error code.

2000-01-20  Morten Welinder  <terra@diku.dk>

	* src/functions/fn-math.c (gnumeric_power): Correct error code.

	* src/functions/fn-stat.c (gnumeric_avedev): Correct error code.
	(gnumeric_varp): Ditto.
	(gnumeric_var): Ditto.
	(gnumeric_median): Ditto.
	(gnumeric_min): Empty list yields zero, not error.
	(gnumeric_max): Ditto.
parent 3aafc86e
2000-01-20 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_power): Correct error code.
* src/functions/fn-stat.c (gnumeric_avedev): Correct error code.
(gnumeric_varp): Ditto.
(gnumeric_var): Ditto.
(gnumeric_median): Ditto.
(gnumeric_min): Empty list yields zero, not error.
(gnumeric_max): Ditto.
2000-01-20 Jody Goldberg <jgoldberg@home.com>
* src/workbook-cmd-format.c (workbook_cmd_format_{col,row}_{hide,unhide}) :
......
2000-01-20 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_power): Correct error code.
* src/functions/fn-stat.c (gnumeric_avedev): Correct error code.
(gnumeric_varp): Ditto.
(gnumeric_var): Ditto.
(gnumeric_median): Ditto.
(gnumeric_min): Empty list yields zero, not error.
(gnumeric_max): Ditto.
2000-01-20 Jody Goldberg <jgoldberg@home.com>
* src/workbook-cmd-format.c (workbook_cmd_format_{col,row}_{hide,unhide}) :
......
......@@ -1117,8 +1117,10 @@ gnumeric_power (FunctionEvalInfo *ei, Value **argv)
if ((x > 0) || (x == 0 && y > 0) || (x < 0 && y == floor (y)))
return value_new_float (pow (x, y));
/* FIXME: What is supposed to happen for x=y=0? */
return value_new_error (ei->pos, gnumeric_err_VALUE);
if (x == 0 && y != 0)
return value_new_error (ei->pos, gnumeric_err_DIV0);
else
return value_new_error (ei->pos, gnumeric_err_NUM);
}
/***************************************************************************/
......
......@@ -137,7 +137,7 @@ gnumeric_varp (FunctionEvalInfo *ei, GList *expr_node_list)
range_var_pop,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_DIV0);
}
/***************************************************************************/
......@@ -170,7 +170,7 @@ gnumeric_var (FunctionEvalInfo *ei, GList *expr_node_list)
range_var_est,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_DIV0);
}
/***************************************************************************/
......@@ -931,12 +931,22 @@ static char *help_min = {
"@SEEALSO=MAX,ABS")
};
static int
range_min0 (const float_t *xs, int n, float_t *res)
{
if (n == 0) {
*res = 0;
return 0;
} else
return range_min (xs, n, res);
}
Value *
gnumeric_min (FunctionEvalInfo *ei, GList *expr_node_list)
{
return float_range_function (expr_node_list,
ei,
range_min,
range_min0,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
......@@ -962,12 +972,22 @@ static char *help_max = {
"@SEEALSO=MIN,ABS")
};
static int
range_max0 (const float_t *xs, int n, float_t *res)
{
if (n == 0) {
*res = 0;
return 0;
} else
return range_max (xs, n, res);
}
Value *
gnumeric_max (FunctionEvalInfo *ei, GList *expr_node_list)
{
return float_range_function (expr_node_list,
ei,
range_max,
range_max0,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
......@@ -2120,7 +2140,7 @@ gnumeric_avedev (FunctionEvalInfo *ei, GList *expr_node_list)
range_avedev,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_NUM);
}
/***************************************************************************/
......@@ -2335,7 +2355,7 @@ gnumeric_median (FunctionEvalInfo *ei, GList *expr_node_list)
range_excel_median,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_NUM);
}
/***************************************************************************/
......
No preview for this file type
......@@ -1117,8 +1117,10 @@ gnumeric_power (FunctionEvalInfo *ei, Value **argv)
if ((x > 0) || (x == 0 && y > 0) || (x < 0 && y == floor (y)))
return value_new_float (pow (x, y));
/* FIXME: What is supposed to happen for x=y=0? */
return value_new_error (ei->pos, gnumeric_err_VALUE);
if (x == 0 && y != 0)
return value_new_error (ei->pos, gnumeric_err_DIV0);
else
return value_new_error (ei->pos, gnumeric_err_NUM);
}
/***************************************************************************/
......
......@@ -137,7 +137,7 @@ gnumeric_varp (FunctionEvalInfo *ei, GList *expr_node_list)
range_var_pop,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_DIV0);
}
/***************************************************************************/
......@@ -170,7 +170,7 @@ gnumeric_var (FunctionEvalInfo *ei, GList *expr_node_list)
range_var_est,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_DIV0);
}
/***************************************************************************/
......@@ -931,12 +931,22 @@ static char *help_min = {
"@SEEALSO=MAX,ABS")
};
static int
range_min0 (const float_t *xs, int n, float_t *res)
{
if (n == 0) {
*res = 0;
return 0;
} else
return range_min (xs, n, res);
}
Value *
gnumeric_min (FunctionEvalInfo *ei, GList *expr_node_list)
{
return float_range_function (expr_node_list,
ei,
range_min,
range_min0,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
......@@ -962,12 +972,22 @@ static char *help_max = {
"@SEEALSO=MIN,ABS")
};
static int
range_max0 (const float_t *xs, int n, float_t *res)
{
if (n == 0) {
*res = 0;
return 0;
} else
return range_max (xs, n, res);
}
Value *
gnumeric_max (FunctionEvalInfo *ei, GList *expr_node_list)
{
return float_range_function (expr_node_list,
ei,
range_max,
range_max0,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
......@@ -2120,7 +2140,7 @@ gnumeric_avedev (FunctionEvalInfo *ei, GList *expr_node_list)
range_avedev,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_NUM);
}
/***************************************************************************/
......@@ -2335,7 +2355,7 @@ gnumeric_median (FunctionEvalInfo *ei, GList *expr_node_list)
range_excel_median,
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS,
gnumeric_err_VALUE);
gnumeric_err_NUM);
}
/***************************************************************************/
......
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