Skip to content

Commit

Permalink
feat: some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wangmengCC committed Aug 31, 2023
1 parent e87d6d1 commit 549aae3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 04-algrithm/08-bigNumber/__tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { bigAdd, bigMin } = require("../20230826大数加减");
const { bigAdd, bigMin } = require("../index");

describe("大数加减", () => {
describe("加法", () => {
Expand Down
5 changes: 3 additions & 2 deletions 04-algrithm/08-bigNumber/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function bigMin(a1, a2) {
// 小减大,负数
(a1[0] === "-" && a2[0] === "-") ||
// 小减大,负数
(!a1[0] === "-" && !a2[0] === "-")
(a1[0] !== "-" && a2[0] !== "-")
) {
if (compare(a1, a2) < 0) {
// -123 - -12
Expand Down Expand Up @@ -182,8 +182,9 @@ function bigMin(a1, a2) {
if (compare(a1, a2) > 0) {
res = minus(a1, a2);
} else {
let tmp = a1;
a1 = a2;
a2 = a1;
a2 = tmp;
res = minus(a1, a2);
}
}
Expand Down

0 comments on commit 549aae3

Please sign in to comment.