Skip to content

Commit

Permalink
Merge pull request #6730 from iamnithishraja/iamnithishraja/#6728
Browse files Browse the repository at this point in the history
max and min now evaluates correctly
  • Loading branch information
limzykenneth authored Jan 15, 2024
2 parents c0d9515 + 328b523 commit 626bdc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/math/calculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ p5.prototype.max = function(...args) {
const findMax = arr => {
let max = -Infinity;
for (let x of arr) {
max = x > max ? x : max;
max = Math.max(max, x);
}
return max;
};
Expand Down Expand Up @@ -551,7 +551,7 @@ p5.prototype.min = function(...args) {
const findMin = arr => {
let min = Infinity;
for (let x of arr) {
min = x < min ? x : min;
min = Math.min(min, x);
}
return min;
};
Expand Down

0 comments on commit 626bdc9

Please sign in to comment.