bug-fix -- adding negative num to zero used to give a positive result.

(this bug was introduced only recently, about a week ago, with the changes
to 128-bit intermediate calculations, and does not/should not affect any
actual users).


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10130 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2004-07-02 03:13:43 +00:00
parent 56059a5a22
commit f440c3ac8d

View File

@ -327,9 +327,11 @@ gnc_numeric_add(gnc_numeric a, gnc_numeric b,
}
else if(b.num == 0) {
denom = a.denom;
b.denom = a.denom;
}
else if(a.num == 0) {
denom = b.denom;
a.denom = b.denom;
}
else {
return gnc_numeric_error(GNC_ERROR_DENOM_DIFF);
@ -378,6 +380,7 @@ gnc_numeric_add(gnc_numeric a, gnc_numeric b,
if (cab.isbig) return gnc_numeric_error(GNC_ERROR_OVERFLOW);
sum.num = cab.lo;
if (cab.isneg) sum.num = -sum.num;
sum.denom = lcd;
}