summaryrefslogtreecommitdiff
path: root/tests/tadd.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-06-25 12:50:21 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-06-25 12:50:21 +0000
commit3995ccc2ac359a2a66c567b0cc48b0ca987231e7 (patch)
tree3b27dc661eafea4e607eec2540e61f4ee32f9340 /tests/tadd.c
parent4fc658f4c030cdf8550bcf1a308df660ce617aae (diff)
downloadmpfr-3995ccc2ac359a2a66c567b0cc48b0ca987231e7.tar.gz
More code clean-up (for both consistency and readability):
* Use the simple mp_limb_t constants when possible. * New internal macro MPFR_IS_NORMALIZED. Note: this was done with perl -pi -e ' s/~ *\(mp_limb_t\) *0/MPFR_LIMB_MAX/g; s/\(mp_limb_t\) *-1/MPFR_LIMB_MAX/g; s/\(mp_limb_t\) *0/MPFR_LIMB_ZERO/g; s/\(mp_limb_t\) *1L?/MPFR_LIMB_ONE/g' {src,tests}/*.{c,h} svn revert src/mpfr-impl.h and some manual changes. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9091 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tadd.c')
-rw-r--r--tests/tadd.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/tadd.c b/tests/tadd.c
index 5b01b3993..60ca68cd8 100644
--- a/tests/tadd.c
+++ b/tests/tadd.c
@@ -248,8 +248,7 @@ check64 (void)
printf ("Error in mpfr_sub: u=x-t and x=x-t give different results\n");
exit (1);
}
- if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
- ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ if (! MPFR_IS_NORMALIZED (u))
{
printf ("Error in mpfr_sub: result is not msb-normalized (1)\n");
exit (1);
@@ -306,8 +305,7 @@ check64 (void)
mpfr_set_str_binary(x, "0.10000000000000000000000000000000E1");
mpfr_set_str_binary(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0");
mpfr_sub(u, x, t, MPFR_RNDN);
- if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
- ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ if (! MPFR_IS_NORMALIZED (u))
{
printf ("Error in mpfr_sub: result is not msb-normalized (2)\n");
exit (1);
@@ -320,8 +318,7 @@ check64 (void)
mpfr_set_str_binary (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35");
mpfr_set_str_binary (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1");
mpfr_sub (u, t, x, MPFR_RNDU);
- if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
- ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ if (! MPFR_IS_NORMALIZED (u))
{
printf ("Error in mpfr_sub: result is not msb-normalized (3)\n");
exit (1);
@@ -334,8 +331,7 @@ check64 (void)
mpfr_set_str_binary (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315");
mpfr_set_str_binary (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350");
mpfr_sub (u, x, t, MPFR_RNDU);
- if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
- ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ if (! MPFR_IS_NORMALIZED (u))
{
printf ("Error in mpfr_sub: result is not msb-normalized (4)\n");
exit (1);