正在加载图片...
7.1 Uniform Deviates 285 Constants for Quick and Dirty Random Number Generators overflow at im ia ic overflow at im ia ic 6075 106 1283 864361093 18257 220 121500 1021 25673 7875 211 1663 259200 421 54773 221 227 7875 421 1663 117128 1277 24749 23 121500 2041 25673 6075 1366 1283 312500 741 66037 6655 936 1399 228 11979 430 2531 145800 3661 30809 83 223 175000 2661 36979 granted for 19881992 14406 967 3041 233280 1861 49297 29282 419 6173 244944 1597 51749 (including this one) 53125 171 11213 229 23 11-800-872 139968 3877 29573 /Cambridge 12960 1741 2731 214326 3613 45289 from NUMERICAL RECIPES IN 14000 1541 2957 714025 1366 150889 21870 1291 4621 230 31104 625 6571 1344568121 28411 139968 205 29573 2592007141 54773 to any server computer, 225 231 (North America to make one paper THE 29282 1255 6173 2332809301 49297 ART 81000 421 17117 7140254096150889 是 e University Press.Programs 134456 281 28411 232 236 send email st st Copyright (C) unsigned long idum,itemp float rand; #ifdef vax static unsigned long jflone 0x00004080; OF SCIENTIFIC COMPUTING(ISBN static unsigned long jflmsk Oxffff007f; #else static unsigned long jflone Ox3f800000; static unsigned long jflmsk =Ox007fffff; 10-621 #endif sa v@cambridge.org 1988-1992 by Numerical Recipes 1dum=1664525L*1dum+1013904223L; 43106 itemp iflone I (iflmsk&idum); rand (*(float *)&itemp)-1.0; (outside The hex constants 3F800000 and 007FFFFF are the appropriate ones for computers using Software. the IEEE representation for 32-bit floating-point numbers (e.g.,IBM PCs and most UNIX North workstations).For DEC VAXes,the correct hex constants are,respectively,00004080 and Ame FFFF007F.Notice that the IEEE mask results in the floating-point number being constructed out of the 23 low-order bits of the integer,which is not ideal.(Your authors have tried very hard to make almost all of the material in this book machine and compiler independent indeed,even programming language independent.This subsection is a rare aberration. Forgive us.Once in a great while the temptation to be really dirty is just irresistible.) Relative Timings and Recommendations Timings are inevitably machine dependent.Nevertheless the following table7.1 Uniform Deviates 285 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). Constants for Quick and Dirty Random Number Generators overflow at im ia ic 6075 106 1283 220 7875 211 1663 221 7875 421 1663 222 6075 1366 1283 6655 936 1399 11979 430 2531 223 14406 967 3041 29282 419 6173 53125 171 11213 224 12960 1741 2731 14000 1541 2957 21870 1291 4621 31104 625 6571 139968 205 29573 225 29282 1255 6173 81000 421 17117 134456 281 28411 226 overflow at im ia ic 86436 1093 18257 121500 1021 25673 259200 421 54773 227 117128 1277 24749 121500 2041 25673 312500 741 66037 228 145800 3661 30809 175000 2661 36979 233280 1861 49297 244944 1597 51749 229 139968 3877 29573 214326 3613 45289 714025 1366 150889 230 134456 8121 28411 259200 7141 54773 231 233280 9301 49297 714025 4096 150889 232 unsigned long idum,itemp; float rand; #ifdef vax static unsigned long jflone = 0x00004080; static unsigned long jflmsk = 0xffff007f; #else static unsigned long jflone = 0x3f800000; static unsigned long jflmsk = 0x007fffff; #endif ... idum = 1664525L*idum + 1013904223L; itemp = jflone | (jflmsk & idum); rand = (*(float *)&itemp)-1.0; The hex constants 3F800000 and 007FFFFF are the appropriate ones for computers using the IEEE representation for 32-bit floating-point numbers (e.g., IBM PCs and most UNIX workstations). For DEC VAXes, the correct hex constants are, respectively, 00004080 and FFFF007F. Notice that the IEEE mask results in the floating-point number being constructed out of the 23 low-order bits of the integer, which is not ideal. (Your authors have tried very hard to make almost all of the material in this book machine and compiler independent — indeed, even programming language independent. This subsection is a rare aberration. Forgive us. Once in a great while the temptation to be really dirty is just irresistible.) Relative Timings and Recommendations Timings are inevitably machine dependent. Nevertheless the following table
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有