Bug 504200

Summary: Floating point precision errors in unit converter
Product: [Plasma] krunner Reporter: hendrikloewe3
Component: converterAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: alexander.lohnau, natalie_clarius, nate
Priority: NOR    
Version First Reported In: 6.3.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description hendrikloewe3 2025-05-14 08:57:55 UTC
SUMMARY
When converting certain values, the unit converter in KRunner shows a rounded value in the result list, but when pressing the suggestion to copy it, it will copy a number with floating point precision errors. Either the displayed value should be copied to the clipboard or the unit converter should work with arbitrary floating point numbers instead

STEPS TO REPRODUCE
1. Open KRunner
2. Enter 5.1mm
3. Click the 0.0051m option

OBSERVED RESULT
0.0050999999999999995 is copied to the clipboard

EXPECTED RESULT
0.0051m should be copied to the clipboard.

SOFTWARE/OS VERSIONS
Operating System: Nobara Linux 42
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.9.0
Kernel Version: 6.14.5-200.nobara.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31,3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3070
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C56
System Version: 1.0
Comment 1 Nate Graham 2025-05-14 16:41:13 UTC
Can reproduce.