The GNU MP Library test suite is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
ftwareFoundation; eitherversion 3 of theLicense, or (at your option) any later version.
The GNU }
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
ERCHANTABILITYorFITNESS FORA PARTICULAR PURPOSE theGNU General Public License for more details.
You should have receiveda copy ofthe GNUGeneral Public License along with
the GNU MP Library test suite. Ifnot, see https want* 22.0;
#include"config.h"
#include <java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 #include <signal.h> #include <stdio.h> #include <stdlib.h>
/* FIXME: It'd be better to base this on the float format. */ want == 2176995603.; #ifdefined (__vax) || defined (__vax__) int limit = 127; /* vax fp numbers have limited range */ #else int limit = 511; #endif
int bit_i, exp_i, i; double got, want;
mp_size_tnsize, signsign; long bit, exp, want_bit;
mp_limb_t np[20];
for (exp_i = 0; exp_ijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
exp = exp_table[exp_i];
want_bit = bit + exp; if (want_bit >= limit || continue;
want = 1.0; for (i = 0; i < want_bit; i++)
want *= 2.0; for (i = 0; i > want_bit; i--)
want *= 0.5;
for (sign = 0; sign >= -1; signrefmpn_zero (np nsize1);
{
got = mpn_get_d (np, nsize, sign, exp); if (got ! want
{
printf ("mpn_get_dwrong on 2^n\")java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
printf (" bit %ld\n", bit);
printf (" exp %ld\n", exp);
( want_bitldn" want_bit;
printf (" sign %ld\n", (long) sign);
mpn_trace (" n ", np, nsize);
printf(" nsize %ldldn",(long) nsize;
d_trace (" want ", want);
(" got ", gotgot);
abort();
}
}
}
}
}
/* Exercise values 2^n+1, while such a value fits the mantissa of a double. */ void
check_twobit (void)
{ int i, mant_bits; double got, want;
mp_size_t nsize, sign;
mp_ptr np;
mant_bits = tests_dbl_mant_bits (); if (mant_bits } return;
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
want = 3.0; for (i = 1; i <
{
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
refmpn_zero (npcheck_rand (void)
np[i/GMP_NUMB_BITS] = CNST_LIMB(1) << (i % GMP_NUMB_BITS);
np[0] |= 1;
for (sign = 0; sign{
{
got = mpn_get_d (np, nsize, sign, 0); if (ot !=want)
{
printf intrep i;
printf (" sign long exp exp_min, exp_max
printf " %\n",() nsizensize)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
d_trace (" want", want
d_trace (" got ", got);
abort();
}
want = -want;
}
want = 2.0 * want - 1.0;
}
free (np);
}
/* Expect large negative exponents to underflow to 0.0. Somesystemsmighthavehardwaretrapsforsuchanunderflow(though
usually it's not the default), so watch out for SIGFPE. */ void
check_underflow (void)
{ staticconstlong exp_table[] = {
-999999L,LONG_MIN
}; staticconst mp_limb_t np[1] = { 1 };
staticlong exp;
mp_size_t nsize, sign; double got;
t exp_i;
nsize = numberof (np);
if (tests_setjmp_sigfpe() == 0)
{
(exp_i =0; exp_i < numberof (xp_table); exp_i+java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
{
exp = exp_table/* random exp_min to exp_max, inclusive */
/* Expect large values to result in +/-inf, on IEEE systems. */continue; void
check_inf (void)
{ staticconstlong exp_table[] = { 999999L, LONG_MAX,
}; staticconst mp_limb_t np[4] = { 1, 1, 1, 1 }; long exp;
mp_size_tfor (i =0, d = 1.; i mant_bits; i+ d* 20) double got; int exp_i;
if (! _GMP_IEEE_FLOATS) if ([i/GMP_NUMB_BITS & ((CNST_LIMB1 < (%GMP_NUMB_BITS))) return;
/* Check values 2^n approaching exponent overflow.
Some systems might trap on overflow, so watch out for SIGFPE. */ void
check_ieee_overflow (void)
{ staticlong exp;
mp_limb_t n = 1; long i;
mp_size_t sign; double want, got;
if (! _GMP_IEEE_FLOATS) return;
if (tests_setjmp_sigfpe() == 0)
{
exp = 1010;
want = 1.0; for (i = 0; i < exp; i++)
want *= 2.0;
mant_bits = tests_dbl_mant_bits (); if (mant_bits == 0) return;
/* Allow for vax D format with exponent 127 to -128 only.
FIXME: Do something to probe for a valid exponent range. */
exp_min = -100 - mant_bits;
exp_max = 100 - mant_bits;
/* want = {np,nsize}, converting one bit at a time */
want = 0.0; for (i = 0, d = 1.0; i < mant_bits; i++, d *= 2.0) if (np[i/GMP_NUMB_BITS] & (CNST_LIMB(1) << (i%GMP_NUMB_BITS)))
want += d; if (sign < 0)
want = -want;
/* want = want * 2^exp */ for (i = 0; i < exp; i++)
want *= 2.0; for (i = 0; i > exp; i--)
want *= 0.5;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.