d1mach.c

来自「DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.」· C语言 代码 · 共 30 行

C
30
字号
/** d1mach - determine machine precision.  Instead of using the
 * original fortran version (or f2c'd version), use this C code
 * instead. This is code is actually in a comment in the original
 * fortran code.
 *
 * Note, that by using this C code, d1mach is now thread safe,
 * whereas, the f2c code was not.
 *
 */
 

/* Standard C source for D1MACH */
#include <stdio.h>
#include <float.h> 
#include <math.h> 
#include "v3p_f2c_original.h"
double d1mach_(integer *i) 
{ 
  switch(*i)
    { 
    case 1: return DBL_MIN; 
    case 2: return DBL_MAX; 
    case 3: return DBL_EPSILON/FLT_RADIX; 
    case 4: return DBL_EPSILON;
    case 5: return log10((double)FLT_RADIX); 
    } 
  fprintf(stderr, "invalid argument: d1mach(%ld)\n", (long) *i);
  return 0; /* some compilers demand return values */
} 

⌨️ 快捷键说明

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