HandyOrg / HandyOrg/HandyControl
NumberTextBox 精度问题
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
NumberTextBox 控件,设置Increment=0.1d,DecimalPlaces=2, 点击增加箭头,逐个增加数值。无法显示2.30,显示的是2.29;
Steps to reproduce the bug
调试中发现:
Math.Truncate(230d)/100
2.3
Math.Truncate(Math.Pow(10,2)*2.3)/Math.Pow(10,2)
2.29
Math.Truncate(230d)/100d
2.3
Expected behavior
No response
Screenshots
No response
NuGet package version
None
IDE
No response
Framework type
No response
Windows version
No response
Additional context
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the NumberTextBox control and the code handling Increment=0.1d with DecimalPlaces=2, then reproduce the arrow-increment case described in the issue. Done means successive increments display 2.30 rather than 2.29, with coverage for the reported floating-point boundary if relevant tests exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100