[gcalctool] currency: Fix calculation of currency values (#643499)



commit aa1b049773528edd6264f3302c981d0eb3b73603
Author: Robin Sonefors <ozamosi flukkost nu>
Date:   Tue Mar 1 20:23:23 2011 +0100

    currency: Fix calculation of currency values (#643499)
    
    Both the IMF and the ECB currencies were added backwards.

 src/currency-manager.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/currency-manager.c b/src/currency-manager.c
index a25b12e..c43f768 100644
--- a/src/currency-manager.c
+++ b/src/currency-manager.c
@@ -384,6 +384,7 @@ load_imf_rates(CurrencyManager *manager)
                         c = add_currency(manager, name_map[name_index].symbol);
                     }
                     mp_set_from_string(tokens[value_index], 10, &value);
+                    mp_reciprocal(&value, &value);
                     currency_set_value(c, &value);
                 }
                 else
@@ -423,7 +424,7 @@ set_ecb_rate(CurrencyManager *manager, xmlNodePtr node, Currency *eur_rate)
         c = add_currency(manager, name);
         mp_set_from_string(value, 10, &r);
         mp_set_from_mp(currency_get_value(eur_rate), &v);
-        mp_divide(&v, &r, &v);
+        mp_multiply(&v, &r, &v);
         currency_set_value(c, &v);
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]