diff options
author | mbkma <[email protected]> | 2020-03-05 13:06:45 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-03-08 21:40:41 +0100 |
commit | b0117b1d5ae73916c6f0d289be1f693bb5f46824 (patch) | |
tree | 4751c73751ed9951ae5a1c5b93f04c84593c6974 /src/unit-category.c | |
parent | 91962719d06ce16d8bc3523872b83fae4d151e10 (diff) | |
download | mate-calc-b0117b1d5ae73916c6f0d289be1f693bb5f46824.tar.bz2 mate-calc-b0117b1d5ae73916c6f0d289be1f693bb5f46824.tar.xz |
Port to GNU MPFR/MPC Library
For further information please visit:
https://www.mpfr.org/
http://www.multiprecision.org/mpc
Diffstat (limited to 'src/unit-category.c')
-rw-r--r-- | src/unit-category.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/unit-category.c b/src/unit-category.c index b8fa303..72f50d5 100644 --- a/src/unit-category.c +++ b/src/unit-category.c @@ -106,18 +106,23 @@ unit_category_get_units(UnitCategory *category) gboolean unit_category_convert(UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z) { - MPNumber t; - g_return_val_if_fail (category != NULL, FALSE); g_return_val_if_fail (x_units != NULL, FALSE); g_return_val_if_fail (z_units != NULL, FALSE); g_return_val_if_fail (z != NULL, FALSE); + MPNumber t = mp_new(); if (!unit_convert_from(x_units, x, &t)) + { + mp_clear(&t); return FALSE; + } if (!unit_convert_to(z_units, &t, z)) + { + mp_clear(&t); return FALSE; - + } + mp_clear(&t); return TRUE; } |