GnuCash
Contact   Instructions
Bug 797318 - Amounts ending in zero displayed as fractions
Summary: Amounts ending in zero displayed as fractions
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: User Interface General (show other bugs)
Version: 3.6
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: ui
QA Contact: ui
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-23 11:30 EDT by vaaydayaasra
Modified: 2020-05-31 06:04 EDT (History)
6 users (show)

See Also:


Attachments
Screenshot of expense view with fractions (35.40 KB, image/png)
2019-07-23 11:30 EDT, vaaydayaasra
no flags Details

Description vaaydayaasra 2019-07-23 11:30:33 EDT
Created attachment 373332 [details]
Screenshot of expense view with fractions

I created a test project with Mauritanian ouguiya (MRO) as the currency. Usually when I input an amount in the expense field, the figure is either without decimals or with one decimal rounded to the following fifth (35 35.2 35.4 etc.), since one fifth is the smallest coin ever issued for this currency.

Now for some reason, whenever I input an amount that ends in a zero with no decimals, such as 30, 500, 2500 etc., the system displays it as "30 + 0/1", i.e. "thirty plus zero parts of one". The fraction is useless and potentially confusing, and I have no idea why it appears only with figures ending in zero. See the attached screenshot where I have typed in 30, 31 and 30.2 on subsequent lines.

I'm using GnuCash 3.6, build ID 3.6+(2019-06-29), on 64-bit Windows 8.1.
Comment 1 John Ralls 2019-07-23 14:08:27 EDT
This goes away with the change in the MRO smallest fraction from 5 to 100. I suspect it's because 1/5 doesn't calculate exactly in binary floating point and because 5 can't be represented as an integer power of 10 it evades the special-casing in the conversion routines.
Comment 2 Jean Laroche 2020-04-04 13:19:17 EDT
I'm going to take a look at this.
Comment 3 Jean Laroche 2020-04-04 14:07:51 EDT
mmm I can't reproduce the problem. When I leave the account with "Use commodity value", it looks like the smallest fraction is 1/100 so there's no issue.
The xml file says parts-per-unit = 5 but smallest fraction 100
This was changed in july 2019, 
feee495f2 Tue Feb 25 16:39:26 2020 +0100 Geert Janssens Bug 797624 - Wrong Decimal for Vietnam currencies
a0a0ffbb7 Thu Jul 25 23:51:50 2019 +0200 Frank H. Ellenberger Bug 797319 - Mauritanian ouguiya MRO shows too few decimals
c77607c8c Thu Jul 25 23:33:42 2019 +0200 Frank H. Ellenberger Bug 797316 - New Mauritanian ouguiya MRU not supported
ca87572a2 Tue Jul 23 09:42:43 2019 -0700 John Ralls Bug 797319 - Mauritanian ouguiya MRO shows too few decimals
So I think this issue should be closed, no?

Or should we change the smallest fraction to 1/5 and fix the resulting display bug? 
Jean
Comment 4 Jean Laroche 2020-04-04 14:16:28 EDT
Ah, OK if I change the smallest fraction to 1/5 then I see the problem. I'll try to fix that.
Comment 5 Bob 2020-05-31 06:04:02 EDT
Jean's fix was added to version 3.10, PR #681

Note You need to log in before you can comment on or make changes to this bug.