正在加载图片...
20.1 Diagnosing Machine Parameters 893 for (;;) tempsoneta if (temp-one !zero)break; a *beta; ++(*machep); 来eps=a; *ngrd=0; Determine ngrd. temp=one+(*eps); if (*irnd ==0&&temptone-one !zero)*ngrd=1; 1=0; Determine iexp. k=1; http://www.nr read able files Permission is z=betain; t=one+(*eps); nxres=0; 83 for (;;) Loop until an underflow occurs,then exit. yZi z=y*y; 11-600 (including this one) granted fori a=ztone; Check here for the underflow internet temp=z*t; 872 if (ata =zero fabs(z)>=y)break; tempi=temp*betain; from NUMERICAL RECIPES IN if (templ*beta =z)break; +1; k+=k; 7423 (North America if (*ibeta !10){ to any server computer,is tusers to make one paper 1988-1992 by Cambridge University Press.Programs THE *1exp=1+1; mx=k+k; else For decimal machines only. only), *1eXp=2; iz=(*ibeta); while (k >iz){ iz **ibeta; strictly prohibited. ++(*iexp); Copyright (C) mx=1z+1z-1: for (;;) To determine minexp and xmin,loop until an to directcustser *xmin=yi underflow occurs,then exit. ART OF SCIENTIFIC COMPUTING(ISBN 0-521 y *=betain; a=y*one; Check here for the underflow. temp=y*t; if (ata !zero&&fabs(y)<*xmin){ ++k; temp1=temp*betain; v@cambridge.org 1988-1992 by Numerical Recipes if (tempi*beta =y &temp !y){ -431085 nxres=3; *xmin=y; break; else break; (outside North America) Software. *minexp =-ki Determine maxexp,xmax. if (mx <k+k-3 &k *ibeta !10){ mx +mx; ++(*1exp) *maxexp=mx+(*minexp); *irnd +nxres; Adjust irnd to reflect partial underflow if (*irnd >2)*maxexp -2; Adjust for IEEE-style machines. i=(*maxexp)+(*minexp) Adjust for machines with implicit leading bit in binary mantissa,and machines with radix20.1 Diagnosing Machine Parameters 893 Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). for (;;) { temp=one+a; if (temp-one != zero) break; a *= beta; ++(*machep); } *eps=a; *ngrd=0; Determine ngrd. temp=one+(*eps); if (*irnd == 0 && temp*one-one != zero) *ngrd=1; i=0; Determine iexp. k=1; z=betain; t=one+(*eps); nxres=0; for (;;) { Loop until an underflow occurs, then exit. y=z; z=y*y; a=z*one; Check here for the underflow. temp=z*t; if (a+a == zero || fabs(z) >= y) break; temp1=temp*betain; if (temp1*beta == z) break; ++i; k += k; } if (*ibeta != 10) { *iexp=i+1; mx=k+k; } else { For decimal machines only. *iexp=2; iz=(*ibeta); while (k >= iz) { iz *= *ibeta; ++(*iexp); } mx=iz+iz-1; } for (;;) { To determine minexp and xmin, loop until an *xmin=y; underflow occurs, then exit. y *= betain; a=y*one; Check here for the underflow. temp=y*t; if (a+a != zero && fabs(y) < *xmin) { ++k; temp1=temp*betain; if (temp1*beta == y && temp != y) { nxres=3; *xmin=y; break; } } else break; } *minexp = -k; Determine maxexp, xmax. if (mx <= k+k-3 && *ibeta != 10) { mx += mx; ++(*iexp); } *maxexp=mx+(*minexp); *irnd += nxres; Adjust irnd to reflect partial underflow. if (*irnd >= 2) *maxexp -= 2; Adjust for IEEE-style machines. i=(*maxexp)+(*minexp); Adjust for machines with implicit leading bit in binary mantissa, and machines with radix
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有