SID-00902: SpreadSheetPlugin AVERAGE not behaving correctly for 0 value
Status: |
Answered |
TWiki version: |
4.3.1 |
Perl version: |
5.10.0 |
Category: |
SpreadSheetPlugin |
Server OS: |
SuSE 11, 2.6.27.19-5-pae |
Last update: |
13 years ago |
I have several complex CALC calls that do an AVERAGE on a range of cells above the CALC. This works fine for the most part, except when the value of one of the cells is 0. After a little digging, I found that when doFunc for AVERAGE calls "getListAsFloat", that sub undefs the 0 value, removing it completely from the calculation.
If I change the following line in getListAsFloat:
$val = $list[$i] || "";
To:
$val = $list[$i];
The calc is correct in this case. Question is: is there a reason why getListAsFloat would want to remove 0 values in other cases?
--
NickThorpe - 2010-07-14
Discussion and Answer
That looks like a bug that needs to be fixed. We need to distinguish between empty cells and cells with value 0.
--
PeterThoeny - 2010-07-15
I filed
TWikibug:Item6523 to track this. Thanks Nick for reporting!
--
PeterThoeny - 2010-07-15
Hmm, I am trying to reproduce. Below example works as expected, there are 5 valid numbers, sum is 15, so average is 3.
Can you bring an example that reproduces the bug?
--
PeterThoeny - 2010-07-15
I think that has been fixed by
TWikibug:Item6493 (
TWikirev:19124), can you upgrade to latest plugin and verify?
--
PeterThoeny - 2010-07-15
You're right, it works fine in v19136. We were on v18078. Thank you for the quick feedback!
--
NickThorpe - 2010-07-15
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.