Skip to content

Commit

Permalink
fix(InputNumber): float add integer error (Tencent#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericleungs authored and oljc committed May 9, 2023
1 parent e9458e6 commit 3e4abc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/input-number/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function positiveAdd(num1: number, num2: number): number {
const r1 = num1.toString().split('.')[1]?.length || 0;
const r2 = num2.toString().split('.')[1]?.length || 0;
// 整数不存在精度问题,直接返回
if (!r1 || !r2) return num1 + num2;
if (!r1 && !r2) return num1 + num2;
let newNumber1 = num1;
let newNumber2 = num2;
const diff = Math.abs(r1 - r2);
Expand Down

0 comments on commit 3e4abc7

Please sign in to comment.