Moving average returns "-0" (<> 0) although it should mathematically be 0

Hi everyone,

I’ve used the “Moving Average” node to return the average of the past 12 months.

  • For the majority, the MA was calculated correctly.
  • For some however it returned a “-0”, although it is mathematically supposed to be a 0 --> i.e., the average of 12 cells being 0 should return a 0.
  • When processed further in Excel for review, the “-0” is treated as e.g., 1.77635683940025E-15 or 3.5527136788005E-15 in Excel.

–> See example pictures attached below.

How do I get the correct 0 instead of the “-0”?

Many thanks in advance and best regards,
Isabell


Hi Isabell,

thank you for your post! This looks like a bug and I will create a bug ticket, so that our developers can work on this.

As a workaround for now, you could use a rule engine node and set a value to zero, if it is smaller than a certain value, e.g. 10^(-15).
You can also see the “true” value in KNIME Analytics Platform by right clicking on the column headers and selecting full precision.

Best,
Kathrin

2 Likes

Hi @Isabell!

Can you just check that the values you are averaging are really zeroes? As Kathrin described it do it by right clicking on the column headers and selecting full precision. If these values are not all zeroes it would explain why MA is not zero :wink:

Br,
Ivan

1 Like

Hey both,

Many thanks for your quick replies.

@Ivan: I already checked and confirmed that they are real zero values - so that can’t be it.
@Kathrin: Thanks, that’s how I solved it for now - slight turnaround with the rule engine node and absolute value smaller/larger than a very small value => 0. Also thanks for the tip with full precision, I wasn’t aware of that.

Cheers,
Isabell

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.