! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
bad calculations
Status:
RESOLVED: INVALID
Priority:
Very High
Product:
Xfce4-calculator-plugin
Component:
General

Comments

Description Vaclav 2018-10-14 15:06:51 CEST
xfce4-calculator-plugin 0.6.0

371.48-375=
-3.519999999999982

10-9.53
0.4700000000000006

etc. 

Problems with calculation accuracy.
Comment 1 Andre Miranda editbugs 2018-10-14 23:28:21 CEST
This is how calculator-plugin formats the operation result:
g_strdup_printf("%.16g", r);

That mask could be simplified to "%g" so the outputs are "-3.52" and "0.47" as expected.
I reviewed the source code history and there has been a fixed decimal length since the first commit.
Well, it's pretty easy to change that mask, I'm just not sure if that would result in undesired formatting.
Comment 2 Simon Steinbeiss editbugs 2020-05-22 23:09:28 CEST
This isn't really a bug. Maybe the formatting could be configurable instead.

If it's really that important to you please file a feature request describing your use case. Thanks!

Bug #14760

Reported by:
Vaclav
Reported on: 2018-10-14
Last modified on: 2020-05-22

People

Assignee:
Roland Kübert
CC List:
2 users

Version

Version:
unspecified

Attachments

Additional information