Skip to content

Commit

Permalink
fix(vectors): update minor()/major()
Browse files Browse the repository at this point in the history
- update iteration order of default impls of both fns
  • Loading branch information
postspectacular committed Oct 5, 2023
1 parent 33c35b4 commit 88b3008
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vectors/src/major.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const major: MultiVecOpRoV<number> = vop();
major.default((a) => {
let id = -1;
let max = -Infinity;
for (let i = a.length; i-- > 0; ) {
for (let i = 0, n = a.length; i < n; i++) {
const x = abs(a[i]);
if (x > max) {
max = x;
Expand Down
2 changes: 1 addition & 1 deletion packages/vectors/src/minor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const minor: MultiVecOpRoV<number> = vop();
minor.default((a) => {
let id = -1;
let min = Infinity;
for (let i = a.length; i-- > 0; ) {
for (let i = 0, n = a.length; i < n; i++) {
const x = abs(a[i]);
if (x < min) {
min = x;
Expand Down

0 comments on commit 88b3008

Please sign in to comment.