diff options
author | dgp <dgp@users.sourceforge.net> | 2019-11-02 17:38:16 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2019-11-02 17:38:16 (GMT) |
commit | 01259957664a85983b70597fdda501c1641cb65d (patch) | |
tree | 85370e770482ee4039e5fdb4fa1fedb0c46d58a1 /generic/tclStrToD.c | |
parent | f594ed900cf74888e871d30ba1fb8091e846d5db (diff) | |
parent | 92be9569b81be3e3c9c99455ad609fe5f8e2e76e (diff) | |
download | tcl-01259957664a85983b70597fdda501c1641cb65d.zip tcl-01259957664a85983b70597fdda501c1641cb65d.tar.gz tcl-01259957664a85983b70597fdda501c1641cb65d.tar.bz2 |
merge 8,6
Diffstat (limited to 'generic/tclStrToD.c')
-rw-r--r-- | generic/tclStrToD.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 9eeb89d..1862290 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -4599,10 +4599,10 @@ TclBignumToDouble( bits = mp_count_bits(a); if (bits > DBL_MAX_EXP*log2FLT_RADIX) { errno = ERANGE; - if (a->sign == MP_ZPOS) { - return HUGE_VAL; - } else { + if (mp_isneg(a)) { return -HUGE_VAL; + } else { + return HUGE_VAL; } } shift = mantBits - bits; @@ -4632,10 +4632,10 @@ TclBignumToDouble( mp_div_2d(a, -shift, &b, NULL); if (mp_isodd(&b)) { - if (b.sign == MP_ZPOS) { - mp_add_d(&b, 1, &b); - } else { + if (mp_isneg(&b)) { mp_sub_d(&b, 1, &b); + } else { + mp_add_d(&b, 1, &b); } } } else { @@ -4645,10 +4645,10 @@ TclBignumToDouble( */ mp_div_2d(a, -1-shift, &b, NULL); - if (b.sign == MP_ZPOS) { - mp_add_d(&b, 1, &b); - } else { + if (mp_isneg(&b)) { mp_sub_d(&b, 1, &b); + } else { + mp_add_d(&b, 1, &b); } mp_div_2d(&b, 1, &b, NULL); } @@ -4674,10 +4674,10 @@ TclBignumToDouble( * Return the result with the appropriate sign. */ - if (a->sign == MP_ZPOS) { - return r; - } else { + if (mp_isneg(a)) { return -r; + } else { + return r; } } @@ -4850,7 +4850,7 @@ BignumToBiasedFrExp( */ *machexp = bits - mantBits + 2; - return ((a->sign == MP_ZPOS) ? r : -r); + return (mp_isneg(a) ? -r : r); } /* |