Sum, wrong decimal result
Bug #1199657 reported by
Mattia Migliorini
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Calculator App |
Fix Released
|
Medium
|
Dariusz Gadomski |
Bug Description
App version: 0.1.3bzr97raring0
I did the following calculation:
6267.4+
3133.7+
2000+
1000+
1000=
The result was:
13401.099999999
Obviously the correct result is 13041.1.
Related branches
lp:~dgadomski/ubuntu-calculator-app/ubuntu-calculator-app
- Ubuntu Phone Apps Jenkins Bot: Approve (continuous-integration)
- Riccardo Padovani: Approve
- Dalius (community): Approve
- Mihir Soni: Approve
-
Diff: 1998 lines (+1925/-15)2 files modifiedbignumber.js (+1912/-0)
engine.js (+13/-15)
Changed in ubuntu-calculator-app: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Dariusz Gadomski (dgadomski) |
status: | Triaged → In Progress |
Changed in ubuntu-calculator-app: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
It is a well know problem to JS devs: stackoverflow. com/questions/ 11695618/ dealing- with-float- precision- in-javascript stackoverflow. com/questions/ 1458633/ elegant- workaround- for-javascript- floating- point-number- problem
* http://
* http://
I have chosen to use an external library (https:/ /github. com/MikeMcl/ bignumber. js) to do the precision job. It is published under MIT Expat license.
Please find the correct behaviour pictured on the screenshot attached.