microsoft / microsoft/microsoft-ui-xaml

SignificantDigitsNumberRounder not rounding to Zero

Open
#10,751 1 comment 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

SignificantDigitsNumberRounder does not round small values to zero

### Why is this important?

In a NumberBox values might show as 0.03 -> 0.02 -> 0.01 but then 0.000000xx when it should actually be 0.00

### Steps to reproduce the bug

In Visual Studio create a default WinUi Blank App (Packaged) C++
In a suitable place put the code
```
Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder sdnr;
sdnr.SignificantDigits(2);
double d = sdnr.RoundDouble(0.00001);
```
inspect the resulting value of d

### Actual behavior

resulting value is not rounded to 0.00

### Expected behavior

resulting value should be rounded to 0.00

### Screenshots

_No response_

### NuGet package version

None

### Windows version

Windows 11 (24H2): Build 26100

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the SignificantDigitsNumberRounder entry point and reproduce the supplied C++ WinUI example using SignificantDigits(2) and RoundDouble(0.00001). Trace the rounding behavior for small values and add regression coverage showing that the result becomes zero while preserving the expected behavior for ordinary values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.