Prices in Price Database dialog

John Ralls jralls at ceridwen.us
Mon Apr 3 12:18:20 EDT 2017


> On Apr 3, 2017, at 8:21 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> 
> Hi,
> 
> I gave been seeing these error messages in my trace file...
> 
> * 15:53:27  WARN <qof> [gnc_numeric_to_decimal()] Rounding required when
> 'never round' specified.
> * 15:53:27  WARN <qof> [gnc_numeric_to_decimal()] Rounding required when
> 'never round' specified.
> * 15:53:27  WARN <qof> [gnc_numeric_to_decimal()] Rounding required when
> 'never round' specified.
> 
> and was not sure why they were there, a bt revealed this ...
> 
> #0  0x00007ffff756cbd8 in g_logv () from /usr/lib/libglib-2.0.so.0
> #1  0x00007ffff756ce0f in g_log () from /usr/lib/libglib-2.0.so.0
> #2  0x00007ffff5ff0f77 in gnc_numeric_to_decimal (a=a at entry=0x7fffffffd7d0,
> max_decimal_places=max_decimal_places at entry=0x0)
>    at
> /var/tmp/portage/app-office/gnucash-2.6.99/work/gnucash-2.6.99/src/libqof/qof/gnc-numeric.cpp:1054
> #3  0x00007ffff69bac9c in PrintAmountInternal (info=<synthetic pointer>,
> val=..., buf=0x7ffff6bd4400 <buf> "-1,240.04")
>    at
> /var/tmp/portage/app-office/gnucash-2.6.99/work/gnucash-2.6.99/src/app-utils/gnc-ui-util.c:1357
> #4  xaccSPrintAmount (bufp=bufp at entry=0x7ffff6bd4400 <buf> "-1,240.04",
> val=..., info=...)
>    at
> /var/tmp/portage/app-office/gnucash-2.6.99/work/gnucash-2.6.99/src/app-utils/gnc-ui-util.c:1652
> #5  0x00007ffff69bb5bf in xaccPrintAmount (val=..., info=...)
>    at
> /var/tmp/portage/app-office/gnucash-2.6.99/work/gnucash-2.6.99/src/app-utils/gnc-ui-util.c:1693
> #6  0x00007ffff6c713d3 in gnc_tree_model_price_get_value
> (tree_model=0x7c18a0, iter=<optimized out>, column=<optimized out>,
>    value=0x7fffffffd9e0) at
> /var/tmp/portage/app-office/gnucash-2.6.99/work/gnucash-2.6.99/src/gnome-utils/gnc-tree-model-price.c:784
> 
> I can see that the print_info is set in model_price to be 6 decimal places
> but on the attached screen shot you can see the warnings are against the
> ones that are fractions in the list.
> I would of expected all entries to be displayed to 6 decimal places.
> 
> Is this correct and should just be ignored or should some thing be changed ?

Bob,

Well, it's doing what we're telling it to, and the warning is a side effect: PrintAmountInternal calls gnc_numeric_to_decimal() to find out if the number can be exactly represented as a decimal, and in order for that to work gnc_numeric_to_decimal() has to set the rounding flag to exact, which causes the rounding code to post the warning when it finds that it must round the result.

That said, some users complain that prices are displayed too exactly and that displaying some as decimals and others as rationals is confusing., e.g. https://bugzilla.gnome.org/show_bug.cgi?id=410060 <https://bugzilla.gnome.org/show_bug.cgi?id=410060>. If you decide to fix it do note that xaccPrintAmount is widely used, so be careful!

Regards,
John Ralls



More information about the gnucash-devel mailing list