Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(InputNumber): float add integer error #1251

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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