fix: 10% should not rely on the preceding numerical values.#190
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:release/eaglefrom Jan 20, 2026
Merged
Conversation
The calculation of 10% should not rely on the preceding numerical values. User expectation: 10% + 10% = 0.2 10%的计算不应该依赖其前面的数值,用户期望:10%+10%=0.2。 Bug: https://pms.uniontech.com/bug-view-347383.html
There was a problem hiding this comment.
Sorry @lichaofan2008, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
deepin pr auto review这段代码修改涉及计算器中百分比运算的逻辑变更。以下是对该代码变更的详细审查和改进建议: 1. 语法逻辑审查
2. 代码质量审查
3. 代码性能审查
4. 代码安全审查
5. 综合改进建议修改后的代码建议: // 建议在文件头部或类中定义常量
// static const HNumber PERCENT_FACTOR("0.01");
// ... 在函数内部 ...
Quantity Evaluator::exec(const QVector<Opcode> &opcodes, ...) {
// ...
case Opcode::Percent:
// ... (获取 val1 的代码) ...
// 改进点:
// 1. 移除被注释的旧代码,保持整洁。
// 2. 使用常量替代字符串字面量(如果已定义)。
// 3. 明确逻辑:这里执行的是纯粹的百分比转换,不涉及累加。
// 逻辑说明:将输入值转换为纯小数形式 (例如 10 -> 0.1)
val1 = checkOperatorResult(val1 * HNumber("0.01"));
// 警告:此逻辑修改意味着 "100 + 10%" 将变为 100.1 而非 110。
// 如果这是为了修复特定Bug或符合特定需求,请确保已更新相关的单元测试。
m_standardPercent = val1;
stack.push(val1);
break;
// ...
}总结:
建议在合并此代码前,务必更新相关的单元测试用例,特别是针对 |
max-lvs
approved these changes
Jan 20, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lichaofan2008, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The calculation of 10% should not rely on the preceding numerical values. User expectation: 10% + 10% = 0.2
10%的计算不应该依赖其前面的数值,用户期望:10%+10%=0.2。
Bug: https://pms.uniontech.com/bug-view-347383.html