/* Maybe set up some platform specific issues */
static void nbSpecialSetup()
{
    mwDisableErrorBoxes();

  #if ENABLE_CRLIBM
    /* Try to handle inconsistencies with x87. We shouldn't use
     * this. This helps, but there can still be some problems for some
     * values. Sticking with SSE2 is the way to go. */
    crlibm_init();
  #endif

  #ifdef _MSC_VER
    /* FIXME: Also for mingw, but seems to be missing */
    /* Make windows printing be more consistent. For some reason it
     * defaults to printing 3 digits in the exponent. There are still
     * issues where the rounding of the last digit by printf on
     * windows in a small number of cases. */
    _set_output_format(_TWO_DIGIT_EXPONENT);
  #endif /* _WIN32 */
}
int main() {
  interval x, y;
  crlibm_init();
  x.INF = 1.5;
  x.SUP = 1.5;

  //  x=j_log(x);
  //printf(" [ %1.30e  ,\n   %1.30e]", x.INF, x.SUP);
  //exit(0);


  for (i=0; i<100; i++) {
    y=j_log(x);
    x=j_exp(y);
    printHexa("yinf:",y.INF);
    printHexa("ysup:",y.SUP);
    printHexa("xinf:",x.INF);
    printHexa("xsup:",x.SUP);
  }
  printf("y: [%1.30e  ,   %1.30e]     ", y.INF, y.SUP);
  printf("Result: [%1.30e  ,   %1.30e]\n", x.INF, x.SUP);
}
示例#3
0
文件: Float.cpp 项目: YotaVGA/cassata
 setupConstants()
 {
     crlibm_init();
 }
int main (int argc, char *argv[]) 
{ 
  char* function_name;
  int seed;
  if ((argc != 3)) usage(argv[0]);
  else{
    function_name = argv[1];
    sscanf(argv[2],"%d", &seed);
    if ((strcmp(function_name,"exp")!=0) && (strcmp(function_name,"j_exp")!=0) && (strcmp(function_name,"log")!=0) && (strcmp(function_name,"j_log")!=0) && (strcmp(function_name,"expm1")!=0) && (strcmp(function_name,"j_expm1")!=0) && (strcmp(function_name,"log2")!=0) && (strcmp(function_name,"j_log2")!=0))
    {
      fprintf (stderr, "\nUnknown function:  %s \n", function_name);
      return 1;
    }
    if ((strcmp(function_name,"log")==0) || (strcmp(function_name,"j_log")==0))
    {
      randfun = rand_for_log;
      testfun_crlibm_interval = j_log;
      testfun_crlibm_low = log_rd;
      testfun_crlibm_up = log_ru;
      testfun_mpfr = mpfr_log;
    }
    if ((strcmp(function_name,"log2")==0) || (strcmp(function_name,"j_log2")==0))
    {
      randfun = rand_for_log;
      testfun_crlibm_interval = j_log2;
      testfun_crlibm_low = log2_rd;
      testfun_crlibm_up = log2_ru;
      testfun_mpfr = mpfr_log2;
    }
    if ((strcmp(function_name,"exp")==0) || (strcmp(function_name,"j_exp")==0))
    {
      randfun = rand_generic;
      testfun_crlibm_interval = j_exp;
      testfun_crlibm_low = exp_rd;
      testfun_crlibm_up = exp_ru;
      testfun_mpfr = mpfr_exp;
    }
    if ((strcmp(function_name,"expm1")==0) || (strcmp(function_name,"j_expm1")==0))
    {
      randfun = rand_for_expm1_soaktest;
      testfun_crlibm_interval = j_expm1;
      testfun_crlibm_low = expm1_rd;
      testfun_crlibm_up = expm1_ru;
      testfun_mpfr = mpfr_expm1;
    }

    crlibm_init();


    mpfr_init2(mp_res,  200);
    mpfr_init2(mp_inpt, 53);
    mpfr_init2(mp_inpt2, 53);

  printf("Testing %s function \n",function_name);


  srand(seed);

  test_all();
  }
  return 0;
}