explicit comparison

This commit is contained in:
Francois Perrad 2018-11-28 10:44:22 +01:00
parent 6f652de71e
commit 034cd1f444
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ double mp_get_double(const mp_int *a)
for (i = USED(a); i --> 0;) { for (i = USED(a); i --> 0;) {
d = d * fac + (double)DIGIT(a, i); d = d * fac + (double)DIGIT(a, i);
} }
return mp_isneg(a) ? -d : d; return (mp_isneg(a) != MP_NO) ? -d : d;
} }
#endif #endif

View File

@ -38,7 +38,7 @@ int mp_set_double(mp_int *a, double d)
} }
res = exp < 0 ? mp_div_2d(a, -exp, a, 0) : mp_mul_2d(a, exp, a); res = exp < 0 ? mp_div_2d(a, -exp, a, 0) : mp_mul_2d(a, exp, a);
if ((cast.bits >> 63) && !mp_iszero(a)) { if (((cast.bits >> 63) != 0ULL) && (mp_iszero(a) == MP_NO)) {
SIGN(a) = MP_NEG; SIGN(a) = MP_NEG;
} }