Tags:
create new tag
view all tags

SID-00902: SpreadSheetPlugin AVERAGE not behaving correctly for 0 value

Status: Answered 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.

Nr Sum Average
1 2 2
2 4 4
3    
4 6 6
5 0 0
6 3 3
CALC: 15 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

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title SpreadSheetPlugin AVERAGE not behaving correctly for 0 value
SupportCategory SpreadSheetPlugin
TWiki version 4.3.1
Server OS SuSE 11, 2.6.27.19-5-pae
Web server Apache 2.2.10
Perl version 5.10.0
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2010-07-15 - NickThorpe
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.