normal_tables.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. // normal_misc_examples.cpp
  2. // Copyright Paul A. Bristow 2007, 2010, 2014, 2016.
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt
  6. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. // Example of using normal distribution.
  8. // Note that this file contains Quickbook mark-up as well as code
  9. // and comments, don't change any of the special comment mark-ups!
  10. /*`
  11. First we need some includes to access the normal distribution
  12. (and some std output of course).
  13. */
  14. #include <boost/cstdfloat.hpp> // MUST be first include!!!
  15. // See Implementation of Float128 type, Overloading template functions with float128_t.
  16. #include <boost/math/distributions/normal.hpp> // for normal_distribution.
  17. using boost::math::normal; // typedef provides default type of double.
  18. #include <iostream>
  19. //using std::cout; using std::endl;
  20. //using std::left; using std::showpoint; using std::noshowpoint;
  21. #include <iomanip>
  22. //using std::setw; using std::setprecision;
  23. #include <limits>
  24. //using std::numeric_limits;
  25. /*!
  26. Function max_digits10
  27. Returns maximum number of possibly significant decimal digits for a floating-point type FPT,
  28. even for older compilers/standard libraries that
  29. lack support for std::std::numeric_limits<FPT>::max_digits10,
  30. when the Kahan formula 2 + binary_digits * 0.3010 is used instead.
  31. Also provides the correct result for Visual Studio 2010 where the max_digits10 provided for float is wrong.
  32. */
  33. namespace boost
  34. {
  35. namespace math
  36. {
  37. template <typename FPT>
  38. int max_digits10()
  39. {
  40. // Since max_digits10 is not defined (or wrong) on older systems, define a local max_digits10.
  41. // Usage: int m = max_digits10<boost::float64_t>();
  42. const int m =
  43. #if (defined BOOST_NO_CXX11_NUMERIC_LIMITS) || (_MSC_VER == 1600) // is wrongly 8 not 9 for VS2010.
  44. 2 + std::numeric_limits<FPT>::digits * 3010/10000;
  45. #else
  46. std::numeric_limits<FPT>::max_digits10;
  47. #endif
  48. return m;
  49. }
  50. } // namespace math
  51. } // namespace boost
  52. template <typename FPT>
  53. void normal_table()
  54. {
  55. using namespace boost::math;
  56. FPT step = static_cast<FPT>(1.); // step in z.
  57. FPT range = static_cast<FPT>(10.); // min and max z = -range to +range.
  58. // Traditional tables are only computed to much lower precision.
  59. // but @c std::std::numeric_limits<double>::max_digits10;
  60. // on new Standard Libraries gives 17,
  61. // the maximum number of digits from 64-bit double that can possibly be significant.
  62. // @c std::std::numeric_limits<double>::digits10; == 15
  63. // is number of @b guaranteed digits, the other two digits being 'noisy'.
  64. // Here we use a custom version of max_digits10 which deals with those platforms
  65. // where @c std::numeric_limits is not specialized,
  66. // or @c std::numeric_limits<>::max_digits10 not implemented, or wrong.
  67. int precision = boost::math::max_digits10<FPT>();
  68. // std::cout << typeid(FPT).name() << std::endl;
  69. // demo_normal.cpp:85: undefined reference to `typeinfo for __float128'
  70. // [@http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43622 GCC 43622]
  71. // typeinfo for __float128 was missing GCC 4.9 Mar 2014, but OK for GCC 6.1.1.
  72. // Construct a standard normal distribution s, with
  73. // (default mean = zero, and standard deviation = unity)
  74. normal s;
  75. std::cout << "\nStandard normal distribution, mean = "<< s.mean()
  76. << ", standard deviation = " << s.standard_deviation() << std::endl;
  77. std::cout << "maxdigits_10 is " << precision
  78. << ", digits10 is " << std::numeric_limits<FPT>::digits10 << std::endl;
  79. std::cout << "Probability distribution function values" << std::endl;
  80. std::cout << " z " " PDF " << std::endl;
  81. for (FPT z = -range; z < range + step; z += step)
  82. {
  83. std::cout << std::left << std::setprecision(3) << std::setw(6) << z << " "
  84. << std::setprecision(precision) << std::setw(12) << pdf(s, z) << std::endl;
  85. }
  86. std::cout.precision(6); // Restore to default precision.
  87. /*`And the area under the normal curve from -[infin] up to z,
  88. the cumulative distribution function (CDF).
  89. */
  90. // For a standard normal distribution:
  91. std::cout << "Standard normal mean = "<< s.mean()
  92. << ", standard deviation = " << s.standard_deviation() << std::endl;
  93. std::cout << "Integral (area under the curve) from - infinity up to z." << std::endl;
  94. std::cout << " z " " CDF " << std::endl;
  95. for (FPT z = -range; z < range + step; z += step)
  96. {
  97. std::cout << std::left << std::setprecision(3) << std::setw(6) << z << " "
  98. << std::setprecision(precision) << std::setw(12) << cdf(s, z) << std::endl;
  99. }
  100. std::cout.precision(6); // Reset to default precision.
  101. } // template <typename FPT> void normal_table()
  102. int main()
  103. {
  104. std::cout << "\nExample: Normal distribution tables." << std::endl;
  105. using namespace boost::math;
  106. try
  107. {// Tip - always use try'n'catch blocks to ensure that messages from thrown exceptions are shown.
  108. //[normal_table_1
  109. #ifdef BOOST_FLOAT32_C
  110. normal_table<boost::float32_t>(); // Usually type float
  111. #endif
  112. normal_table<boost::float64_t>(); // Usually type double. Assume that float64_t is always available.
  113. #ifdef BOOST_FLOAT80_C
  114. normal_table<boost::float80_t>(); // Type long double on some X86 platforms.
  115. #endif
  116. #ifdef BOOST_FLOAT128_C
  117. normal_table<boost::float128_t>(); // Type _Quad on some Intel and __float128 on some GCC platforms.
  118. #endif
  119. normal_table<boost::floatmax_t>();
  120. //] [/normal_table_1 ]
  121. }
  122. catch(std::exception ex)
  123. {
  124. std::cout << "exception thrown " << ex.what() << std::endl;
  125. }
  126. return 0;
  127. } // int main()
  128. /*
  129. GCC 4.8.1 with quadmath
  130. Example: Normal distribution tables.
  131. Standard normal distribution, mean = 0, standard deviation = 1
  132. maxdigits_10 is 9, digits10 is 6
  133. Probability distribution function values
  134. z PDF
  135. -10 7.69459863e-023
  136. -9 1.02797736e-018
  137. -8 5.05227108e-015
  138. -7 9.13472041e-012
  139. -6 6.07588285e-009
  140. -5 1.48671951e-006
  141. -4 0.000133830226
  142. -3 0.00443184841
  143. -2 0.0539909665
  144. -1 0.241970725
  145. 0 0.39894228
  146. 1 0.241970725
  147. 2 0.0539909665
  148. 3 0.00443184841
  149. 4 0.000133830226
  150. 5 1.48671951e-006
  151. 6 6.07588285e-009
  152. 7 9.13472041e-012
  153. 8 5.05227108e-015
  154. 9 1.02797736e-018
  155. 10 7.69459863e-023
  156. Standard normal mean = 0, standard deviation = 1
  157. Integral (area under the curve) from - infinity up to z.
  158. z CDF
  159. -10 7.61985302e-024
  160. -9 1.12858841e-019
  161. -8 6.22096057e-016
  162. -7 1.27981254e-012
  163. -6 9.86587645e-010
  164. -5 2.86651572e-007
  165. -4 3.16712418e-005
  166. -3 0.00134989803
  167. -2 0.0227501319
  168. -1 0.158655254
  169. 0 0.5
  170. 1 0.841344746
  171. 2 0.977249868
  172. 3 0.998650102
  173. 4 0.999968329
  174. 5 0.999999713
  175. 6 0.999999999
  176. 7 1
  177. 8 1
  178. 9 1
  179. 10 1
  180. Standard normal distribution, mean = 0, standard deviation = 1
  181. maxdigits_10 is 17, digits10 is 15
  182. Probability distribution function values
  183. z PDF
  184. -10 7.6945986267064199e-023
  185. -9 1.0279773571668917e-018
  186. -8 5.0522710835368927e-015
  187. -7 9.1347204083645953e-012
  188. -6 6.0758828498232861e-009
  189. -5 1.4867195147342979e-006
  190. -4 0.00013383022576488537
  191. -3 0.0044318484119380075
  192. -2 0.053990966513188063
  193. -1 0.24197072451914337
  194. 0 0.3989422804014327
  195. 1 0.24197072451914337
  196. 2 0.053990966513188063
  197. 3 0.0044318484119380075
  198. 4 0.00013383022576488537
  199. 5 1.4867195147342979e-006
  200. 6 6.0758828498232861e-009
  201. 7 9.1347204083645953e-012
  202. 8 5.0522710835368927e-015
  203. 9 1.0279773571668917e-018
  204. 10 7.6945986267064199e-023
  205. Standard normal mean = 0, standard deviation = 1
  206. Integral (area under the curve) from - infinity up to z.
  207. z CDF
  208. -10 7.6198530241605945e-024
  209. -9 1.1285884059538422e-019
  210. -8 6.2209605742718204e-016
  211. -7 1.279812543885835e-012
  212. -6 9.865876450377014e-010
  213. -5 2.8665157187919455e-007
  214. -4 3.1671241833119972e-005
  215. -3 0.0013498980316300957
  216. -2 0.022750131948179216
  217. -1 0.15865525393145705
  218. 0 0.5
  219. 1 0.84134474606854293
  220. 2 0.97724986805182079
  221. 3 0.9986501019683699
  222. 4 0.99996832875816688
  223. 5 0.99999971334842808
  224. 6 0.9999999990134123
  225. 7 0.99999999999872013
  226. 8 0.99999999999999933
  227. 9 1
  228. 10 1
  229. Standard normal distribution, mean = 0, standard deviation = 1
  230. maxdigits_10 is 21, digits10 is 18
  231. Probability distribution function values
  232. z PDF
  233. -10 7.69459862670641993759e-023
  234. -9 1.0279773571668916523e-018
  235. -8 5.05227108353689273243e-015
  236. -7 9.13472040836459525705e-012
  237. -6 6.07588284982328608733e-009
  238. -5 1.48671951473429788965e-006
  239. -4 0.00013383022576488536764
  240. -3 0.00443184841193800752729
  241. -2 0.0539909665131880628364
  242. -1 0.241970724519143365328
  243. 0 0.398942280401432702863
  244. 1 0.241970724519143365328
  245. 2 0.0539909665131880628364
  246. 3 0.00443184841193800752729
  247. 4 0.00013383022576488536764
  248. 5 1.48671951473429788965e-006
  249. 6 6.07588284982328608733e-009
  250. 7 9.13472040836459525705e-012
  251. 8 5.05227108353689273243e-015
  252. 9 1.0279773571668916523e-018
  253. 10 7.69459862670641993759e-023
  254. Standard normal mean = 0, standard deviation = 1
  255. Integral (area under the curve) from - infinity up to z.
  256. z CDF
  257. -10 7.61985302416059451083e-024
  258. -9 1.12858840595384222719e-019
  259. -8 6.22096057427182035917e-016
  260. -7 1.279812543885834962e-012
  261. -6 9.86587645037701399241e-010
  262. -5 2.86651571879194547129e-007
  263. -4 3.16712418331199717608e-005
  264. -3 0.00134989803163009566139
  265. -2 0.0227501319481792155242
  266. -1 0.158655253931457046468
  267. 0 0.5
  268. 1 0.841344746068542925777
  269. 2 0.977249868051820791415
  270. 3 0.998650101968369896532
  271. 4 0.999968328758166880021
  272. 5 0.999999713348428076465
  273. 6 0.999999999013412299576
  274. 7 0.999999999998720134897
  275. 8 0.999999999999999333866
  276. 9 1
  277. 10 1
  278. Standard normal distribution, mean = 0, standard deviation = 1
  279. maxdigits_10 is 36, digits10 is 34
  280. Probability distribution function values
  281. z PDF
  282. -10 7.69459862670641993759264402330435296e-023
  283. -9 1.02797735716689165230378750485667109e-018
  284. -8 5.0522710835368927324337437844893081e-015
  285. -7 9.13472040836459525705208369548147081e-012
  286. -6 6.07588284982328608733411870229841611e-009
  287. -5 1.48671951473429788965346931561839483e-006
  288. -4 0.00013383022576488536764006964663309418
  289. -3 0.00443184841193800752728870762098267733
  290. -2 0.0539909665131880628363703067407186609
  291. -1 0.241970724519143365327522587904240936
  292. 0 0.398942280401432702863218082711682655
  293. 1 0.241970724519143365327522587904240936
  294. 2 0.0539909665131880628363703067407186609
  295. 3 0.00443184841193800752728870762098267733
  296. 4 0.00013383022576488536764006964663309418
  297. 5 1.48671951473429788965346931561839483e-006
  298. 6 6.07588284982328608733411870229841611e-009
  299. 7 9.13472040836459525705208369548147081e-012
  300. 8 5.0522710835368927324337437844893081e-015
  301. 9 1.02797735716689165230378750485667109e-018
  302. 10 7.69459862670641993759264402330435296e-023
  303. Standard normal mean = 0, standard deviation = 1
  304. Integral (area under the curve) from - infinity up to z.
  305. z CDF
  306. -10 7.61985302416059451083278826816793623e-024
  307. -9 1.1285884059538422271881384555435713e-019
  308. -8 6.22096057427182035917417257601387863e-016
  309. -7 1.27981254388583496200054074948511201e-012
  310. -6 9.86587645037701399241244820583623953e-010
  311. -5 2.86651571879194547128505464808623238e-007
  312. -4 3.16712418331199717608064048146587766e-005
  313. -3 0.001349898031630095661392854111682027
  314. -2 0.0227501319481792155241528519127314212
  315. -1 0.158655253931457046467912164189328905
  316. 0 0.5
  317. 1 0.841344746068542925776512220181757584
  318. 2 0.977249868051820791414741051994496956
  319. 3 0.998650101968369896532351503992686048
  320. 4 0.999968328758166880021462930017150939
  321. 5 0.999999713348428076464813329948810861
  322. 6 0.999999999013412299575520592043176293
  323. 7 0.999999999998720134897212119540199637
  324. 8 0.999999999999999333866185224906075746
  325. 9 1
  326. 10 1
  327. Standard normal distribution, mean = 0, standard deviation = 1
  328. maxdigits_10 is 36, digits10 is 34
  329. Probability distribution function values
  330. z PDF
  331. -10 7.69459862670641993759264402330435296e-023
  332. -9 1.02797735716689165230378750485667109e-018
  333. -8 5.0522710835368927324337437844893081e-015
  334. -7 9.13472040836459525705208369548147081e-012
  335. -6 6.07588284982328608733411870229841611e-009
  336. -5 1.48671951473429788965346931561839483e-006
  337. -4 0.00013383022576488536764006964663309418
  338. -3 0.00443184841193800752728870762098267733
  339. -2 0.0539909665131880628363703067407186609
  340. -1 0.241970724519143365327522587904240936
  341. 0 0.398942280401432702863218082711682655
  342. 1 0.241970724519143365327522587904240936
  343. 2 0.0539909665131880628363703067407186609
  344. 3 0.00443184841193800752728870762098267733
  345. 4 0.00013383022576488536764006964663309418
  346. 5 1.48671951473429788965346931561839483e-006
  347. 6 6.07588284982328608733411870229841611e-009
  348. 7 9.13472040836459525705208369548147081e-012
  349. 8 5.0522710835368927324337437844893081e-015
  350. 9 1.02797735716689165230378750485667109e-018
  351. 10 7.69459862670641993759264402330435296e-023
  352. Standard normal mean = 0, standard deviation = 1
  353. Integral (area under the curve) from - infinity up to z.
  354. z CDF
  355. -10 7.61985302416059451083278826816793623e-024
  356. -9 1.1285884059538422271881384555435713e-019
  357. -8 6.22096057427182035917417257601387863e-016
  358. -7 1.27981254388583496200054074948511201e-012
  359. -6 9.86587645037701399241244820583623953e-010
  360. -5 2.86651571879194547128505464808623238e-007
  361. -4 3.16712418331199717608064048146587766e-005
  362. -3 0.001349898031630095661392854111682027
  363. -2 0.0227501319481792155241528519127314212
  364. -1 0.158655253931457046467912164189328905
  365. 0 0.5
  366. 1 0.841344746068542925776512220181757584
  367. 2 0.977249868051820791414741051994496956
  368. 3 0.998650101968369896532351503992686048
  369. 4 0.999968328758166880021462930017150939
  370. 5 0.999999713348428076464813329948810861
  371. 6 0.999999999013412299575520592043176293
  372. 7 0.999999999998720134897212119540199637
  373. 8 0.999999999999999333866185224906075746
  374. 9 1
  375. 10 1
  376. MSVC 2013 64-bit
  377. 1>
  378. 1> Example: Normal distribution tables.
  379. 1>
  380. 1> Standard normal distribution, mean = 0, standard deviation = 1
  381. 1> maxdigits_10 is 9, digits10 is 6
  382. 1> Probability distribution function values
  383. 1> z PDF
  384. 1> -10 7.69459863e-023
  385. 1> -9 1.02797736e-018
  386. 1> -8 5.05227108e-015
  387. 1> -7 9.13472041e-012
  388. 1> -6 6.07588285e-009
  389. 1> -5 1.48671951e-006
  390. 1> -4 0.000133830226
  391. 1> -3 0.00443184841
  392. 1> -2 0.0539909665
  393. 1> -1 0.241970725
  394. 1> 0 0.39894228
  395. 1> 1 0.241970725
  396. 1> 2 0.0539909665
  397. 1> 3 0.00443184841
  398. 1> 4 0.000133830226
  399. 1> 5 1.48671951e-006
  400. 1> 6 6.07588285e-009
  401. 1> 7 9.13472041e-012
  402. 1> 8 5.05227108e-015
  403. 1> 9 1.02797736e-018
  404. 1> 10 7.69459863e-023
  405. 1> Standard normal mean = 0, standard deviation = 1
  406. 1> Integral (area under the curve) from - infinity up to z.
  407. 1> z CDF
  408. 1> -10 7.61985302e-024
  409. 1> -9 1.12858841e-019
  410. 1> -8 6.22096057e-016
  411. 1> -7 1.27981254e-012
  412. 1> -6 9.86587645e-010
  413. 1> -5 2.86651572e-007
  414. 1> -4 3.16712418e-005
  415. 1> -3 0.00134989803
  416. 1> -2 0.0227501319
  417. 1> -1 0.158655254
  418. 1> 0 0.5
  419. 1> 1 0.841344746
  420. 1> 2 0.977249868
  421. 1> 3 0.998650102
  422. 1> 4 0.999968329
  423. 1> 5 0.999999713
  424. 1> 6 0.999999999
  425. 1> 7 1
  426. 1> 8 1
  427. 1> 9 1
  428. 1> 10 1
  429. 1>
  430. 1> Standard normal distribution, mean = 0, standard deviation = 1
  431. 1> maxdigits_10 is 17, digits10 is 15
  432. 1> Probability distribution function values
  433. 1> z PDF
  434. 1> -10 7.6945986267064199e-023
  435. 1> -9 1.0279773571668917e-018
  436. 1> -8 5.0522710835368927e-015
  437. 1> -7 9.1347204083645953e-012
  438. 1> -6 6.0758828498232861e-009
  439. 1> -5 1.4867195147342979e-006
  440. 1> -4 0.00013383022576488537
  441. 1> -3 0.0044318484119380075
  442. 1> -2 0.053990966513188063
  443. 1> -1 0.24197072451914337
  444. 1> 0 0.3989422804014327
  445. 1> 1 0.24197072451914337
  446. 1> 2 0.053990966513188063
  447. 1> 3 0.0044318484119380075
  448. 1> 4 0.00013383022576488537
  449. 1> 5 1.4867195147342979e-006
  450. 1> 6 6.0758828498232861e-009
  451. 1> 7 9.1347204083645953e-012
  452. 1> 8 5.0522710835368927e-015
  453. 1> 9 1.0279773571668917e-018
  454. 1> 10 7.6945986267064199e-023
  455. 1> Standard normal mean = 0, standard deviation = 1
  456. 1> Integral (area under the curve) from - infinity up to z.
  457. 1> z CDF
  458. 1> -10 7.6198530241605813e-024
  459. 1> -9 1.1285884059538408e-019
  460. 1> -8 6.2209605742718292e-016
  461. 1> -7 1.2798125438858352e-012
  462. 1> -6 9.8658764503770161e-010
  463. 1> -5 2.8665157187919439e-007
  464. 1> -4 3.1671241833119979e-005
  465. 1> -3 0.0013498980316300957
  466. 1> -2 0.022750131948179219
  467. 1> -1 0.15865525393145707
  468. 1> 0 0.5
  469. 1> 1 0.84134474606854293
  470. 1> 2 0.97724986805182079
  471. 1> 3 0.9986501019683699
  472. 1> 4 0.99996832875816688
  473. 1> 5 0.99999971334842808
  474. 1> 6 0.9999999990134123
  475. 1> 7 0.99999999999872013
  476. 1> 8 0.99999999999999933
  477. 1> 9 1
  478. 1> 10 1
  479. 1>
  480. 1> Standard normal distribution, mean = 0, standard deviation = 1
  481. 1> maxdigits_10 is 17, digits10 is 15
  482. 1> Probability distribution function values
  483. 1> z PDF
  484. 1> -10 7.6945986267064199e-023
  485. 1> -9 1.0279773571668917e-018
  486. 1> -8 5.0522710835368927e-015
  487. 1> -7 9.1347204083645953e-012
  488. 1> -6 6.0758828498232861e-009
  489. 1> -5 1.4867195147342979e-006
  490. 1> -4 0.00013383022576488537
  491. 1> -3 0.0044318484119380075
  492. 1> -2 0.053990966513188063
  493. 1> -1 0.24197072451914337
  494. 1> 0 0.3989422804014327
  495. 1> 1 0.24197072451914337
  496. 1> 2 0.053990966513188063
  497. 1> 3 0.0044318484119380075
  498. 1> 4 0.00013383022576488537
  499. 1> 5 1.4867195147342979e-006
  500. 1> 6 6.0758828498232861e-009
  501. 1> 7 9.1347204083645953e-012
  502. 1> 8 5.0522710835368927e-015
  503. 1> 9 1.0279773571668917e-018
  504. 1> 10 7.6945986267064199e-023
  505. 1> Standard normal mean = 0, standard deviation = 1
  506. 1> Integral (area under the curve) from - infinity up to z.
  507. 1> z CDF
  508. 1> -10 7.6198530241605813e-024
  509. 1> -9 1.1285884059538408e-019
  510. 1> -8 6.2209605742718292e-016
  511. 1> -7 1.2798125438858352e-012
  512. 1> -6 9.8658764503770161e-010
  513. 1> -5 2.8665157187919439e-007
  514. 1> -4 3.1671241833119979e-005
  515. 1> -3 0.0013498980316300957
  516. 1> -2 0.022750131948179219
  517. 1> -1 0.15865525393145707
  518. 1> 0 0.5
  519. 1> 1 0.84134474606854293
  520. 1> 2 0.97724986805182079
  521. 1> 3 0.9986501019683699
  522. 1> 4 0.99996832875816688
  523. 1> 5 0.99999971334842808
  524. 1> 6 0.9999999990134123
  525. 1> 7 0.99999999999872013
  526. 1> 8 0.99999999999999933
  527. 1> 9 1
  528. 1> 10 1
  529. */