Skip to content

mode always gets the first number #10

@ghost

Description

I am getting wrong values for mode.

For example, for {4, 3, 3}, I am getting 4 for mode. It is as if, I am getting the first number for mode.

Here are a few examples with arrays of 3 and 4:

4.00 3.00 3.00
Mean: 3.33
Mode: 4.00

4.00 0.00 0.00
Mean: 1.33
Mode: 4.00
Smooth: 2.67

0.00 2.00 2.00
Mean: 1.33
Mode: 0.00
Smooth: 0.67

3.00 3.00 4.00
Mean: 3.33
Mode: 3.00
Smooth: 3.33

4.00 0.00 0.00 2.00
Mean: 1.50
Mode: 4.00

2.00 4.00 3.00 3.00
Mean: 3.00
Mode: 2.00

4.00 3.00 3.00 0.00
Mean: 2.50
Mode: 4.00

Please see below the code:

SmoothObject.ino.zip

Do you know if this is a bug or a result of my code? If it is a result of my code, I would appreciate hearing how to fix it.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions