void __mp_dbl(const mp_no *x, double *y, int p) { #if 0 int i,k; double a,c,u,v,z[5]; #endif if (X[0] == ZERO) {*y = ZERO; return; } if (EX> -42) norm(x,y,p); else if (EX==-42 && X[1]>=TWO10) norm(x,y,p); else denorm(x,y,p); }
/* Convert multiple precision number *X into double precision number *Y. The result is correctly rounded to the nearest/even. */ void __mp_dbl (const mp_no *x, double *y, int p) { if (X[0] == 0) { *y = 0; return; } if (__glibc_likely (EX > -42 || (EX == -42 && X[1] >= TWO10))) norm (x, y, p); else denorm (x, y, p); }
int main(void) { int n = 9 /* 9 */; /* Problem vector size */ double x[9]; /* Function input values */ double fvec[9]; /* Function output values */ double ss; /* Search area */ int info, j; double fnorm; int nprint = 0; /* Itteration debugging print = off */ double tol; error_program = "dnsqtest"; /* Set global error reporting string */ /* Driver for dnsqe example. */ /* Not supplying Jacobian, use approximation */ /* The following starting values provide a rough solution. */ for (j = 1; j <= 9; ++j) { x[j - 1] = -1.f; } ss = 0.1; nprint = 0; /* Set tol to the square root of the machine precision. */ /* Unless high precision solutions are required, */ /* this is the recommended setting. */ tol = sqrt(M_DIVER); info = dnsqe(NULL, fcn, NULL, n, x, ss, fvec, tol, tol, 0, nprint); fnorm = denorm(n, fvec); fprintf(stdout,"Final L2 norm of the residuals = %e\n",fnorm); fprintf(stdout,"Exit return value = %d (1 = sucess)\n",info); fprintf(stdout,"Final approximate solution:\n"); for (j = 0; j < n; j++) { fprintf(stdout,"x[%d] = %f, expect %f\n",j,x[j], expect[j]); } return 0; } /* main() */