⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testvect.c

📁 linux下用PCMCIA无线网卡虚拟无线AP的程序源码
💻 C
📖 第 1 页 / 共 2 页
字号:
    long double (*func) (long double, long double);    long double *arg1;    long double *arg2;    long double *answer;    int thresh;  };struct twoarguments test2[] ={  {"atan2l", atan2l, &ZEROL, &ONEL, &ZEROL, 0},  {"atan2l", atan2l, &NEGZEROL, &ONEL,&NEGZEROL, 0},  {"atan2l", atan2l, &ZEROL, &ZEROL, &ZEROL, 0},  {"atan2l", atan2l, &NEGZEROL, &ZEROL, &NEGZEROL, 0},  {"atan2l", atan2l, &ZEROL, &MONEL, &PIL, 0},  {"atan2l", atan2l, &NEGZEROL, &MONEL, &MPIL, 0},  {"atan2l", atan2l, &ZEROL, &NEGZEROL, &PIL, 0},  {"atan2l", atan2l, &NEGZEROL, &NEGZEROL, &MPIL, 0},  {"atan2l", atan2l, &ONEL, &ZEROL, &PIO2L, 0},  {"atan2l", atan2l, &ONEL, &NEGZEROL, &PIO2L, 0},  {"atan2l", atan2l, &MONEL, &ZEROL, &MPIO2L, 0},  {"atan2l", atan2l, &MONEL, &NEGZEROL, &MPIO2L, 0},  {"atan2l", atan2l, &ONEL, &INFINITYL, &ZEROL, 0},  {"atan2l", atan2l, &MONEL, &INFINITYL, &NEGZEROL, 0},  {"atan2l", atan2l, &INFINITYL, &ONEL, &PIO2L, 0},  {"atan2l", atan2l, &INFINITYL, &MONEL, &PIO2L, 0},  {"atan2l", atan2l, &MINFL, &ONEL, &MPIO2L, 0},  {"atan2l", atan2l, &MINFL, &MONEL, &MPIO2L, 0},  {"atan2l", atan2l, &ONEL, &MINFL, &PIL, 0},  {"atan2l", atan2l, &MONEL, &MINFL, &MPIL, 0},  {"atan2l", atan2l, &INFINITYL, &INFINITYL, &PIO4L, 0},  {"atan2l", atan2l, &MINFL, &INFINITYL, &MPIO4L, 0},  {"atan2l", atan2l, &INFINITYL, &MINFL, &THPIO4L, 0},  {"atan2l", atan2l, &MINFL, &MINFL, &MTHPIO4L, 0},  {"atan2l", atan2l, &ONEL, &ONEL, &PIO4L, 0},  {"atan2l", atan2l, &NANL, &ONEL, &NANL, 0},  {"atan2l", atan2l, &ONEL, &NANL, &NANL, 0},  {"atan2l", atan2l, &NANL, &NANL, &NANL, 0},  {"powl", powl, &ONEL, &ZEROL, &ONEL, 0},  {"powl", powl, &ONEL, &NEGZEROL, &ONEL, 0},  {"powl", powl, &MONEL, &ZEROL, &ONEL, 0},  {"powl", powl, &MONEL, &NEGZEROL, &ONEL, 0},  {"powl", powl, &INFINITYL, &ZEROL, &ONEL, 0},  {"powl", powl, &INFINITYL, &NEGZEROL, &ONEL, 0},  {"powl", powl, &NANL, &ZEROL, &ONEL, 0},  {"powl", powl, &NANL, &NEGZEROL, &ONEL, 0},  {"powl", powl, &TWOL, &INFINITYL, &INFINITYL, 0},  {"powl", powl, &MTWOL, &INFINITYL, &INFINITYL, 0},  {"powl", powl, &HALFL, &INFINITYL, &ZEROL, 0},  {"powl", powl, &MHALFL, &INFINITYL, &ZEROL, 0},  {"powl", powl, &TWOL, &MINFL, &ZEROL, 0},  {"powl", powl, &MTWOL, &MINFL, &ZEROL, 0},  {"powl", powl, &HALFL, &MINFL, &INFINITYL, 0},  {"powl", powl, &MHALFL, &MINFL, &INFINITYL, 0},  {"powl", powl, &INFINITYL, &HALFL, &INFINITYL, 0},  {"powl", powl, &INFINITYL, &TWOL, &INFINITYL, 0},  {"powl", powl, &INFINITYL, &MHALFL, &ZEROL, 0},  {"powl", powl, &INFINITYL, &MTWOL, &ZEROL, 0},  {"powl", powl, &MINFL, &THREEL, &MINFL, 0},  {"powl", powl, &MINFL, &TWOL, &INFINITYL, 0},  {"powl", powl, &MINFL, &MTHREEL, &NEGZEROL, 0},  {"powl", powl, &MINFL, &MTWOL, &ZEROL, 0},  {"powl", powl, &NANL, &ONEL, &NANL, 0},  {"powl", powl, &ONEL, &NANL, &NANL, 0},  {"powl", powl, &NANL, &NANL, &NANL, 0},  {"powl", powl, &ONEL, &INFINITYL, &NANL, 0},  {"powl", powl, &MONEL, &INFINITYL, &NANL, 0},  {"powl", powl, &ONEL, &MINFL, &NANL, 0},  {"powl", powl, &MONEL, &MINFL, &NANL, 0},  {"powl", powl, &MTWOL, &HALFL, &NANL, 0},  {"powl", powl, &ZEROL, &MTHREEL, &INFINITYL, 0},  {"powl", powl, &NEGZEROL, &MTHREEL, &MINFL, 0},  {"powl", powl, &ZEROL, &MHALFL, &INFINITYL, 0},  {"powl", powl, &NEGZEROL, &MHALFL, &INFINITYL, 0},  {"powl", powl, &ZEROL, &THREEL, &ZEROL, 0},  {"powl", powl, &NEGZEROL, &THREEL, &NEGZEROL, 0},  {"powl", powl, &ZEROL, &HALFL, &ZEROL, 0},  {"powl", powl, &NEGZEROL, &HALFL, &ZEROL, 0},  {"null", NULL, &ZEROL, &ZEROL, &ZEROL, 0},};/* Integer functions of one variable.  */int isnanl (long double);int signbitl (long double);struct intans  {    char *name;			/* Name of the function. */    int (*func) (long double);    long double *arg1;    int ianswer;  };struct intans test3[] ={  {"isfinitel", isfinitel, &ZEROL, 1},  {"isfinitel", isfinitel, &INFINITYL, 0},  {"isfinitel", isfinitel, &MINFL, 0},  {"isnanl", isnanl, &NANL, 1},  {"isnanl", isnanl, &INFINITYL, 0},  {"isnanl", isnanl, &ZEROL, 0},  {"isnanl", isnanl, &NEGZEROL, 0},  {"signbitl", signbitl, &NEGZEROL, 1},  {"signbitl", signbitl, &MONEL, 1},  {"signbitl", signbitl, &ZEROL, 0},  {"signbitl", signbitl, &ONEL, 0},  {"signbitl", signbitl, &MINFL, 1},  {"signbitl", signbitl, &INFINITYL, 0},  {"null", NULL, &ZEROL, 0},};static volatile long double x1;static volatile long double x2;static volatile long double y;static volatile long double answer;intmain (){  int i, nerrors, k, ianswer, ntests;  long double (*fun1) (long double);  long double (*fun2) (long double, long double);  int (*fun3) (long double);  long double e;  union    {      long double d;      char c[12];    } u, v;    /* This masks off fpu exceptions on i386.  */    /* setfpu(0x137f); */  nerrors = 0;  ntests = 0;  MINFL = -INFINITYL;  MPIL = -PIL;  MPIO2L = -PIO2L;  MPIO4L = -PIO4L;  i = 0;  for (;;)    {      fun1 = test1[i].func;      if (fun1 == NULL)	break;      x1 = *(test1[i].arg1);      y = (*(fun1)) (x1);      answer = *(test1[i].answer);      if (test1[i].thresh == 0)	{	  v.d = answer;	  u.d = y;	  if (memcmp(u.c, v.c, 10) != 0)	    {	      /* O.K. if both are NaNs of some sort.  */	      if (isnanl(v.d) && isnanl(u.d))		goto nxttest1;	      goto wrongone;	    }	  else	    goto nxttest1;	}      if (y != answer)	{	  e = y - answer;	  if (answer != 0.0L)	    e = e / answer;	  if (e < 0)	    e = -e;	  if (e > test1[i].thresh * MACHEPL)	    {wrongone:	      printf ("%s (%.20Le) = %.20Le\n    should be %.20Le\n",		      test1[i].name, x1, y, answer);	      nerrors += 1;	    }	}nxttest1:      ntests += 1;      i += 1;    }  i = 0;  for (;;)    {      fun2 = test2[i].func;      if (fun2 == NULL)	break;      x1 = *(test2[i].arg1);      x2 = *(test2[i].arg2);      y = (*(fun2)) (x1, x2);      answer = *(test2[i].answer);      if (test2[i].thresh == 0)	{	  v.d = answer;	  u.d = y;	  if (memcmp(u.c, v.c, 10) != 0)	    {	      /* O.K. if both are NaNs of some sort.  */	      if (isnanl(v.d) && isnanl(u.d))		goto nxttest2;	      goto wrongtwo;	    }	  else	    goto nxttest2;	}      if (y != answer)	{	  e = y - answer;	  if (answer != 0.0L)	    e = e / answer;	  if (e < 0)	    e = -e;	  if (e > test2[i].thresh * MACHEPL)	    {wrongtwo:	      printf ("%s (%.20Le, %.20Le) = %.20Le\n    should be %.20Le\n",		      test2[i].name, x1, x2, y, answer);	      nerrors += 1;	    }	}nxttest2:      ntests += 1;      i += 1;    }  i = 0;  for (;;)    {      fun3 = test3[i].func;      if (fun3 == NULL)	break;      x1 = *(test3[i].arg1);      k = (*(fun3)) (x1);      ianswer = test3[i].ianswer;      if (k != ianswer)	{	  printf ("%s (%.20Le) = %d\n    should be. %d\n",		  test3[i].name, x1, k, ianswer);	  nerrors += 1;	}      ntests += 1;      i += 1;    }  printf ("testvect: %d errors in %d tests\n", nerrors, ntests);  exit (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -