52
callback_function_sumxy (Sheet *sheet, int col, int row,
53
GnmCell *cell, void *user_data)
52
callback_function_sumxy (GnmCellIter const *iter, gpointer user)
55
if (NULL == (cell = iter->cell))
59
59
if (VALUE_IS_NUMBER (cell->value)) {
60
math_sums_t *mm = user_data;
60
math_sums_t *mm = user;
61
61
gnm_float *p = g_new (gnm_float, 1);
62
62
*p = value_get_as_float (cell->value);
63
63
mm->list = g_slist_append (mm->list, p);
133
133
static GnmValue *
134
gnumeric_gcd (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
134
gnumeric_gcd (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
136
136
return float_range_function (argc, argv, ei,
202
202
static GnmValue *
203
gnumeric_lcm (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
203
gnumeric_lcm (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
205
205
return float_range_function (argc, argv, ei,
232
232
static GnmValue *
233
gnumeric_hypot (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
233
gnumeric_hypot (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
235
235
return float_range_function (argc, argv, ei,
559
559
} CountIfClosure;
561
561
static GnmValue *
562
cb_countif (Sheet *sheet, int col, int row, GnmCell *cell, CountIfClosure *res)
562
cb_countif (GnmCellIter const *iter, CountIfClosure *res)
568
if (VALUE_IS_NUMBER (cell->value) || VALUE_IS_STRING (cell->value)) {
569
if ((res->test) (cell->value, res->test_value))
565
if (NULL != (cell = iter->cell)) {
567
if ((VALUE_IS_NUMBER (cell->value) ||
568
VALUE_IS_STRING (cell->value)) &&
569
(res->test) (cell->value, res->test_value))
596
596
parse_criteria (argv[1], &res.test, &res.test_value, &iter_flags,
597
597
workbook_date_conv (ei->pos->sheet->workbook));
598
#warning 2006/May/31 Why do we not filter non-existent as a flag, rather than checking for NULL in cb_countif
598
599
problem = sheet_foreach_cell_in_range (sheet, iter_flags,
599
600
r->cell.a.col, r->cell.a.row, r->cell.b.col, r->cell.b.row,
600
601
(CellIterFunc) &cb_countif, &res);
644
645
static GnmValue *
645
cb_sumif (Sheet *sheet, int col, int row, GnmCell *cell,
646
cb_sumif (GnmCellIter const *iter, SumIfClosure *res)
649
if (NULL == (cell = iter->cell))
650
651
cell_eval (cell);
652
if (VALUE_IS_NUMBER (cell->value) || VALUE_IS_STRING (cell->value)) {
653
if ((res->test) (cell->value, res->test_value)) {
654
if (NULL != res->target_sheet) {
655
cell = sheet_cell_get (res->target_sheet,
656
col + res->offset.col, row + res->offset.row);
659
switch (cell->value->type) {
661
/* FIXME: Check bools. */
662
res->sum += value_get_as_float (cell->value);
653
if ((VALUE_IS_NUMBER (cell->value) || VALUE_IS_STRING (cell->value)) &&
654
(res->test) (cell->value, res->test_value)) {
655
if (NULL != res->target_sheet) {
656
cell = sheet_cell_get (res->target_sheet,
657
iter->pp.eval.col + res->offset.col,
658
iter->pp.eval.row + res->offset.row);
661
switch (cell->value->type) {
663
/* FIXME: Check bools. */
664
res->sum += value_get_as_float (cell->value);
669
/* FIXME: Check bools. */
670
res->sum += value_get_as_float (cell->value);
671
/* FIXME: Check bools. */
672
res->sum += value_get_as_float (cell->value);
718
719
parse_criteria (argv[1], &res.test, &res.test_value, &iter_flags,
719
720
workbook_date_conv (ei->pos->sheet->workbook));
721
#warning 2006/May/31 Why do we not filter non-existent as a flag, rather than checking for NULL in cb_sumif
720
722
problem = sheet_foreach_cell_in_range (sheet, iter_flags,
721
723
r->cell.a.col, r->cell.a.row, col_end, row_end,
722
724
(CellIterFunc) &cb_sumif, &res);
1044
1046
/***************************************************************************/
1046
1048
static GnmFuncHelp const help_floor[] = {
1047
{ GNM_FUNC_HELP_OLD,
1048
F_("@FUNCTION=FLOOR\n"
1049
"@SYNTAX=FLOOR(x[,significance])\n"
1049
{ GNM_FUNC_HELP_NAME, F_("FLOOR:rounds down.") },
1050
{ GNM_FUNC_HELP_ARG, F_("x:value.") },
1051
{ GNM_FUNC_HELP_ARG, F_("significance:base multiple (defaults to 1 for @x > 0 and -1 for @x <0)") },
1052
{ GNM_FUNC_HELP_SEEALSO, "CEIL,CEILING,ABS,INT,MOD" },
1053
{ GNM_FUNC_HELP_DESCRIPTION, F_(
1052
1054
"FLOOR function rounds @x down to the next nearest multiple "
1053
"of @significance.\n\n"
1054
"* @significance defaults to 1.\n"
1055
"* This function is Excel compatible.\n"
1058
"FLOOR(0.5) equals 0.\n"
1059
"FLOOR(5,2) equals 4.\n"
1060
"FLOOR(-5,-2) equals -4.\n"
1061
"FLOOR(-5,2) equals #NUM!.\n"
1063
"@SEEALSO=CEIL, CEILING, ABS, INT, MOD")
1055
"of @significance.") },
1056
{ GNM_FUNC_HELP_EXAMPLES, F_("FLOOR(0.5) equals 0.") },
1057
{ GNM_FUNC_HELP_EXAMPLES, F_("FLOOR(5,2) equals 4.") },
1058
{ GNM_FUNC_HELP_EXAMPLES, F_("FLOOR(-5,-2) equals -4.") },
1059
{ GNM_FUNC_HELP_EXAMPLES, F_("FLOOR(-5,2) equals #NUM!.") },
1065
1060
{ GNM_FUNC_HELP_END }
1503
1498
static GnmValue *
1504
gnumeric_suma (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
1499
gnumeric_suma (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
1506
1501
return float_range_function (argc, argv, ei,
1537
1532
static GnmValue *
1538
gnumeric_sumsq (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
1533
gnumeric_sumsq (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
1540
1535
return float_range_function (argc, argv, ei,
1569
1564
static GnmValue *
1570
gnumeric_multinomial (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
1565
gnumeric_multinomial (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
1572
1567
return float_range_function (argc, argv, ei,
1573
1568
range_multinomial,
1600
1595
static GnmValue *
1601
gnumeric_g_product (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
1596
gnumeric_g_product (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
1603
1598
return float_range_function (argc, argv, ei,
2893
2888
static GnmValue *
2894
gnumeric_seriessum (FunctionEvalInfo *ei, int argc, const GnmExprConstPtr *argv)
2889
gnumeric_seriessum (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
2896
2891
return float_range_function (argc, argv, ei,
2897
2892
range_seriessum,
2928
2923
static GnmValue *
2929
cb_function_mmult_validate (Sheet *sheet, int col, int row,
2930
GnmCell *cell, void *user_data)
2924
cb_function_mmult_validate (GnmCellIter const *iter, gpointer user)
2932
int *item_count = user_data;
2926
GnmCell *cell = iter->cell;
2927
int *item_count = user;
2934
2929
cell_eval (cell);
2935
2930
if (!VALUE_IS_NUMBER (cell->value))