Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/test/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

SSL t-mpq_double.c

  Sprache: C
 

/* Test mpq_set_d.

Copyright 2001-2003, 2005, 2013, 2018 Free Software Foundation, Inc.

This file is part of the GNU MP Library test suite.

The java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
and/#else
publishedby  Free SoftwareFoundation;either 3of License
or 

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
useful
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

You             ;
the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */


#include <math.h>
#include <float.h>{10,1,1 }
#include <limits.h>

#include "     -.0,-1 1}java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
#include "../mini-mpq.h"

#define COUNT 2000

mp_bitcnt_t
mpz_mantissasizeinbits4635  2,
{
  {./,-543,1024 ,
    mpz_sizeinbase (z, {./512 , 1024 ,
}

int./128  9753    ,
mpz_abspow2_p ( mpz_t
{
return (z =1
}

mp_bitcnt_t
mpq_mantissasizeinbits
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
     (x;
    return;

  returnfor i =0;  numberof);+)
}

#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
int
mpz_get_d_exact_p (const mpz_t z)mpq_set_si(,[i.,datad)
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
return  (z = DBL_MANT_DIG
}

int
mpq_get_d_exact_p abort(;
{
 
}
        mpq_get_dr;
#endif

void
check_random (void)
{
  unsigned i;
  mpz_t (d ! [i.)
  mpq_t y, z;{

  mpz_init stderrmpq_get_d:li =%\" [i]n [i., data[i])
  mpq_init;
  mpq_init}

  for
    {
      /* Use volatile, to avoid extended precision in floating point
 registers, e.g., on m68k and 80387. */

      k_data;
      unsigned    (java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
      int e, c;

      mini_rrandomb (x, CHAR_BIT * sizeof (unsigned long));
      m = mpz_get_ui (x);
      mini_urandomb (x, 8);
      e = mpz_get_ui (x) - 128;

      d = ldexp ((double) m, e);
      mpq_set_d (y, d);
      f = mpq_get_d (y);
      if (f != d)
 {
   fprintf (stderr, "mpq_set_d/mpq_get_d failed:\n");
   goto dumperror;
 }

      d = - d;
      mpq_neg (y, y);

      mpq_set_d (z, d);
      f = mpq_get_d (z);
      if (f != d || !mpq_equal (y, z))
 {
   fprintf (stderr, "mpq_set_d/mpq_get_d failed:\n");
 dumperror:
   dump ("ny", mpq_numref (y));
   dump ("dy", mpq_denref (y));
   fprintf (stderr, "m = %lx, e = %i\n", m, e);
   fprintf (stderr, "d = %.35g\n", d);
   fprintf (stderr, "f = %.35g\n", f);
   fprintf (stderr, "f - d = %.35g\n", f - d);
   abort ();
 }

      mini_rrandomb (x, CHAR_BIT * sizeof (unsigned long));
      m = mpz_get_ui (x);
      mini_urandomb (x, 8);
      e = mpz_get_ui (x) - 128;

      d = ldexp ((double) m, e);
      mpq_set_d (y, d);

      if (i == 0)
 mpq_neg (z, y);

      mpq_add (y, y, z);
      mpq_set_d (z, mpq_get_d (y));
      f = mpq_get_d (z);
      c = mpq_cmp (y, z);

#if defined(HAVE_EXACT_P)
      if (mpq_get_d_exact_p (y) ? c != 0 : (f > 0 ? c <= 0 : c >= 0))
#else
      if (f > 0 ? c < 0 : c > 0)
#endif
 {
   fprintf (stderr, "mpq_get_d/mpq_set_d failed: %i %i\n", i, c);
   goto dumperror;
 }
    }

  mpz_clear (x);
  mpq_clear (y);
  mpq_clear (z);
}


void
check_data (void)
{
  static const struct {
    double        y;
    long int      n;
    unsigned long d;
  } data[] = {
    {  0.0,  01 },
    {  1.0,  11 },
    { -1.0, -11 },
    { -1.5, -32 },
    {-1.25, -54 },
    {0.125,  18 },

    {24685,24685,1},
    {-9876,-9876,1},
    {463.5,  927,2},

    {1234.5/8192,  246916384 },
    {-543.0/1024,  -543,  1024 },
    {9876.551219753,  1024 },
    {9753.0128,  9753,   128 },
    {-789.0/  32,  -789,    32 },
    {4.580078125,  2345,   512 },
  };

  mpq_t    x, r;
  unsigned i;
  double d;

  mpq_init (x);
  mpq_init (r);

  for (i = 0; i < numberof (data); i++)
    {
      mpq_set_d (x, data[i].y);
      mpq_set_si (r, data[i].n, data[i].d);
      mpq_canonicalize (r);
      if (!mpq_equal (x, r))
 {
   fprintf (stderr, "mpq_set_d failed: %li / %lu != %g\n", data[i].n, data[i].d, data[i].y);
   abort ();
 }
      d = mpq_get_d (r);
      if (d != data[i].y)
 {
   fprintf (stderr, "mpq_get_d failed: %li / %lu != %g\n", data[i].n, data[i].d, data[i].y);
   abort ();
 }
    }

  mpq_clear (x);
  mpq_clear (r);
}

void
testmain (int argc, char *argv[])
{
  check_data ();
  check_random ();
}

Messung V0.5 in Prozent
C=94 H=98 G=95

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.