Commit 9ddd3c3c authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Round properly.

2000-06-13  Morten Welinder  <terra@diku.dk>

	* src/functions/fn-math.c (gnumeric_round): Round properly.
parent 58eef504
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
2000-06-13 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_round): Round properly.
2000-06-12 JP Rosevear <jpr@arcavia.com>
* src/workbook.c (sort_cmd): Adjust if the range to be sorted
......
......@@ -2124,13 +2124,10 @@ gnumeric_round (FunctionEvalInfo *ei, Value **argv)
int digits;
number = value_get_as_float (argv[0]);
if (argv[1] == NULL)
digits = 0;
else
digits = value_get_as_int (argv[1]);
digits = argv[1] ? value_get_as_int (argv[1]) : 0;
p10 = gpow10 (digits);
return value_new_float (rint (number * p10) / p10);
return value_new_float (floor (number * p10 + (number >= 0 ? 0.5 : -0.5)) / p10);
}
/***************************************************************************/
......
......@@ -2124,13 +2124,10 @@ gnumeric_round (FunctionEvalInfo *ei, Value **argv)
int digits;
number = value_get_as_float (argv[0]);
if (argv[1] == NULL)
digits = 0;
else
digits = value_get_as_int (argv[1]);
digits = argv[1] ? value_get_as_int (argv[1]) : 0;
p10 = gpow10 (digits);
return value_new_float (rint (number * p10) / p10);
return value_new_float (floor (number * p10 + (number >= 0 ? 0.5 : -0.5)) / p10);
}
/***************************************************************************/
......
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