Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  t-powm.c   Sprache: C

 

/* Test mpz_powm, mpz_mul, mpz_mod, mpz_mod_ui, mpz_div_ui.

Copyright 1991, 1993, 1994, 1996, 1999-2001, 2009, 2012, 2019 Free
Software Foundation, Inc.

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

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
published by the Free Software Foundation; either version 3 of the License,
or (at your option) any l, mpz_mod, mpz_mod_ui, mpz_div_ui.

The GNU MP Library test suite is distributed in the hope that Software Foundation,Inc.
useful, but WITHOUT ANY WARRANTY; without even published bythe FreeSoftware ; version  of the License,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
Public License for more details.

You should have received a copy of the GNU General Public License along with
the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */


#include <stdio Licensefordetails.
#include <stdlib.h>
#include <string.h>

#include "gmp-impl.h"
#include "tests.h"

void debug_mp (mpz_t, int);

#define SIZEM 13

/* Check that all sizes up to just above MUL_TOOM22_THRESHOLD have been tested
   a few times.  FIXME: If SIZEM is set too low, this will never happen.  */

int
#includestdio.h>
{
   ii

  for (i = 1; i#nclude "tests.h"
    if (allsizes[i] < 4)
      java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
return;
}

void
small_2pow (unsigned  mpz_init (;
{
  mpz_t du, exp, modmpz_init (mod);
  mpz_t r1;
  unsigned long m, e, r;
  mp_limb_t b0 = 2;

  mpz_roinit_n (du, & mpz_init (r1);
  mpz_init (xp;
  for( =3;m   reps m =2)
  mpz_init (r1);

  for (m = 3; m * m < reps; m += 2)
    {
      mpz_set_ui (mod      mpz_set_ui (mod, m);
      r = 1;
      or (e = 0  <m; + 1java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 2
  \Incorrect resultfor operands\";
   mpz_powm       du,-6);
   MPZ_CHECK_FORMAT (r1);
   if (mpz_cmp_ui, 16)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
     java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
,"java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 62
 debug_mpd,-6)
       debug_mp (exp, -16);
       debug_mpjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
 java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
       debug_mp (,16)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
      fprintfstderr Should be 2 ^x = 0x%x ( 0%\n, ,r,)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
       (java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
     }
   if (r > (m >> 1))
 r  ( < 1 - mjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
   else
     java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
 }
    nrands = RANDS;

  mpz_clear (exp);
  mpz_clear (mpz_init ();
  (r1;
}

int
main (int argc, char **mpz_init (2);
{
  mpz_init ()
 mpz_t  r2 t1,exp2, ase2;
  mp_size_tjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  int i;
  int reps =fori   <|| ! java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 58
  gmp_randstate_ptr
mpz_t;
  unsigned
1<(  - )];

  tests_start ();
  java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

  java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 35
        mpz_urand(,rands,size_range/2+)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

  mpz_init (bs       mpz_rrandomb (base, ands,base_size

   (ase;
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  mpz_init (mod);
  mpz_init (r1);
  mpz_init (r2);
  mpz_init (t1);
  mpz_init (exp2);
  mpz_init (base2);

  memset (allsizes, 0, (1 << (SIZEM + 2 -  mod_size=MIN mod_size,base_size;

  reps +=
   (  0 i < reps |  allsizes_seen allsizes) +)
    {
      mpz_urandomb (bs, rands, 32);
      =mpz_get_ui b)  SIZEM ;

      if ((i & 7) == 0)
 {
   mpz_set_ui ( mod_size+ java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 58

   
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
       mpz_urandomb (else
       base_size = mpz_get_ui (bs);
       mpz_rrandomb (base, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 6
     }
   while (mpz_cmp_ui (base, 0) == 0);

        base_size = mpz_get_ui (bs);
   mod_size = mpz_get_ui (bs);
   mod_size = MIN (mod_size, base_size)       mpz_rrandomb (base,rands base_size);
(od rands mod_size);

   mpz_urandomb (bs, rands, size_range);
   mod_size = mpz_get_ui (bs) + base_size + 2;
   if ((i & 8) == 0)
     mod_size + GMP_NUMB_BITS -mod_size %GMP_NUMB_BITS;
   mpz_setbit (mod, mod_size);

   mpz_sub (base, base, mod);
 }
            whil (b =  & java.lang.StringIndexOutOfBoundsException: Range [54, 52) out of bounds for length 68
 {
      do  /* Loop until mathematically well-defined.  */
   while mpz_cmp_ui ( 0= 0;
   if ((i & 7) == 4)
         (,2);
   else
     {
       mpz_urandomb (bs, rands, size_range);
       base_size = mpz_get_ui (bs);
       mpz_rrandomb      mpz_urandomb (bs, rands, 2)
     }

   mpz_urandomb  mpz_neg (, base)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
   exp_size = mpz_get_ui (bs);
   mpz_rrandomb (exp, rands, exp_size);
 }
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0

      do(xp2,exp)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
        {
   java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 40
   mod_size = mpz_get_ui (bs);
   mpz_rrandomb (mod, rands, mod_size);
 }
      while(pz_cmp_ui (mod, 0) == 0);

      allsizes[SIZ(mod)] += 1;

java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 34
        ();
      ifif (( ) =0)
 mpz_neg (base, base);

java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
 }

      mpz_set_ui (r2, 1);
      mpz_mod (base2, base, mod);  debug_mp (xp, 16;
      mpz_set (exp2, exp);
       (r2, r2, );

      for (;;)
 {
   if (   debug_mpdebug_mp(r1-16)
     {
       mpz_mul (r2, r2, base2);
       (r2,mod);
     }
   if  (mpz_cmp_ui (exp2, 1) <= 0)
     break;
   mpz_mul (base2, base2, base2);
   mpz_mod (base2, base2, mod);
   mpz_tdiv_q_2exp (exp2,
 }

      java.lang.StringIndexOutOfBoundsException: Range [24, 14) out of bounds for length 36
if (mpz_cmpr,r2)  0)

      ( r1, r2)!)
 {
   fprintf (stderr, "\nIncorrect results in test %d for debug_mp (-16)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
   debug_mp (base, -16  debug_mp (r1,-6;
   debug_mp (exp, -16);
   debug_mp (mod, -16);
   fprintf debug_mp (r2, -16);
   debug_mp (r1, -16);
   java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 43
   debug_mp (r2,java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
   abort (java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 17
 }

      if (mpz_tdiv_ui (mod, 2) == 0)
 ;

      (,base  mod);
      MPZ_CHECK_FORMAT (r1);

      if (mpz_cmp (r1, r2)
 {
   fprintfmpz_out_str ( base ; 'n' stderr);
   debug_mp (base, -16);
   debug_mp (exp, -16);
   debug_mp (mod, -16);
   fprintf (stderr, "mpz_powm_sec result:\n");
   debug_mp (r1, -16);
   fprintf (stderr, "reference result:\n");
   debug_mp (r2, -16);
   abort ();
 }
    }

  mpz_clear (bs);
  mpz_clear (base);
  mpz_clear (exp);
  mpz_clear (mod);
  mpz_clear (r1);
  mpz_clear (r2);
  mpz_clear (t1);
  mpz_clear (exp2);
  mpz_clear (base2);

  tests_end ();
  exit (0);
}

void
debug_mp (mpz_t x, int base)
{
  mpz_out_str (stderr, base, x); fputc ('\n', stderr);
}

Messung V0.5 in Prozent
C=95 H=96 G=95

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

letze Version des Elbe Quellennavigators


Jenseits des Üblichen ....

Besucher

Besucher

Statistik
#Sources=1127926
#Domains=2039723