Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Mean and MeanBy #414

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Adding Mean and MeanBy #414

wants to merge 3 commits into from

Conversation

usman1100
Copy link

@usman1100 usman1100 commented Dec 30, 2023

Title: Add Mean and MeanBy functions for ints and floats

Issue: #412

Description:

This PR adds two new functions to the math library:

  • Mean: Calculates the mean of a collection of numbers.
  • MeanBy: Calculates the mean of a collection of numbers using a provided iteratee function.

These functions are implemented using generics to support both integers and floats. They do not cater to complex types, as the concept of a mean for complex numbers can be misleading and requires specialized handling.

Thorough unit tests have been included to ensure the correctness of the functions.

Code Changes:

  • Added two functions in math.go
  • Added tests for the two functions in math_test.go

Testing:

All tests pass successfully.

Reviewers, please provide any feedback or questions you may have.

@usman1100
Copy link
Author

@samber Awaiting your review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant