Skip to content

update average.java#1423

Merged
drabbit75 merged 3 commits into
TheAlgorithms:masterfrom
drabbit75:master
Aug 18, 2020
Merged

update average.java#1423
drabbit75 merged 3 commits into
TheAlgorithms:masterfrom
drabbit75:master

Conversation

@drabbit75

Copy link
Copy Markdown
Member
  1. add int type array
  2. The equality of floating-point numbers should be judged by the absolute value of the difference less than a small number

add a findAverage java file in maths directory
1. add int type array
2. The equality of floating-point numbers should be judged by the absolute value of the difference less than a small number
Comment thread Maths/Average.java
assert Math.abs(average(new double[]{5, 10, 15, 20, 25, 30, 35}) - 20) < SMALL_VALUE;
assert Math.abs(average(new double[]{1, 2, 3, 4, 5, 6, 7, 8}) - 4.5) < SMALL_VALUE;
int[] array = {2, 4, 10};
assert average(array) == 5;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 assert average(new int[]{2, 4, 10}) == 5;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is also ok

@drabbit75 drabbit75 merged commit 5ea5309 into TheAlgorithms:master Aug 18, 2020
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.

2 participants