GNOME Bugzilla – Bug 347791
Import does not match any transactions when ATM fees threshold is set to 0
Last modified: 2018-06-29 21:10:04 UTC
In import-backend.c (line 598), if (downloaded_split_amount == match_split_amount) is not true even for matching amounts because of the use of double type. Should be something like: if(fabs(downloaded_split_amount - match_split_amount)<0.001)
Err... yes. In fact, the conversion to double should be thrown out altogether, and instead the gnc_numeric should be used all the way. This would solve this problem once and for all.
I think it was converted to double because gnc_numeric_equal() is fairly expensive. I have no problem with the approach suggested in comment #0
I do have a problem with the approach suggested in comment#0 in this simple form, because the precision must instead be depending on the commodity's SCU. So either we get the SCU and use that ins the difference norm, or we just use the gnc_numeric. The argument of using doubles instead of gnc_numeric_equal() was given by myself in r11496 (gnome2-branch, 2005-10-16); however, at the time I didn't think of this erroneous implications of double values. In the light of this error I would rather go back to the original gnc_numeric_equal().
Why does the precision need to depend on the SCU? The problem here is that 'zero' isn't necessarily 0.0. It could be .00000000000000001 or -0.000000000000001 or something like that. I think it's perfectly reasonable and perfectly safe to say: fabs(diff) < 0.00000000001 But you're welcome to return back to gnc_numeric_equal().
Applied initial suggestion in r14648, awaiting audit and backport.
Backported to 2.0 in r14667.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=347791. Please update any external references or bookmarks.