smock 0.1.217 → 0.1.218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. data/Gemfile.lock +1 -1
  2. data/app/assets/javascripts/modules/category_dropdown.coffee +0 -1
  3. data/examples/pages/homepage.html +1 -0
  4. data/node_modules/exports-loader/.npmignore +1 -0
  5. data/node_modules/exports-loader/README.md +18 -0
  6. data/node_modules/exports-loader/index.js +36 -0
  7. data/node_modules/exports-loader/node_modules/loader-utils/.npmignore +1 -0
  8. data/node_modules/exports-loader/node_modules/loader-utils/README.md +129 -0
  9. data/node_modules/exports-loader/node_modules/loader-utils/index.js +229 -0
  10. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/.bin/json5 +41 -0
  11. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/.npmignore +0 -0
  12. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/LICENCE +23 -0
  13. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/README.md +214 -0
  14. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/big.js +1026 -0
  15. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/big.min.js +1 -0
  16. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/doc/bigAPI.html +1026 -0
  17. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/package.json +61 -0
  18. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/big-vs-bigdecimal.html +678 -0
  19. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/bigtime.js +324 -0
  20. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/BigDecTest.class +0 -0
  21. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/BigDecTest.java +60 -0
  22. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/LICENCE.txt +205 -0
  23. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/bigdecimal.js +592 -0
  24. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/bugs.js +53 -0
  25. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js +5724 -0
  26. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js +61 -0
  27. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_ICU4J/LICENCE.txt +30 -0
  28. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/abs.js +555 -0
  29. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/browser/big-vs-number.html +249 -0
  30. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/browser/every-test.html +66 -0
  31. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/browser/single-test.html +26 -0
  32. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/cmp.js +4305 -0
  33. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/div.js +9978 -0
  34. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/every-test.js +31 -0
  35. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/minus.js +1793 -0
  36. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/mod.js +1838 -0
  37. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/plus.js +1916 -0
  38. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/pow.js +1233 -0
  39. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/round.js +5173 -0
  40. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/sqrt.js +788 -0
  41. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/times.js +2159 -0
  42. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/toExponential.js +472 -0
  43. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/toFixed.js +1030 -0
  44. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/toPrecision.js +508 -0
  45. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/big.js/test/toString.js +1068 -0
  46. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/.npmignore +4 -0
  47. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/CHANGELOG.md +56 -0
  48. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/Makefile +27 -0
  49. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/README.md +173 -0
  50. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/lib/cli.js +41 -0
  51. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/lib/json5.js +462 -0
  52. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/lib/require.js +18 -0
  53. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/package.json +66 -0
  54. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/package.json5 +24 -0
  55. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/empty-array.json +1 -0
  56. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/leading-comma-array.js +3 -0
  57. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/lone-trailing-comma-array.js +3 -0
  58. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/no-comma-array.txt +4 -0
  59. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/regular-array.json +5 -0
  60. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/trailing-comma-array.json5 +3 -0
  61. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-following-array-element.json5 +6 -0
  62. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-following-top-level-value.json5 +5 -0
  63. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-in-string.json +1 -0
  64. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-preceding-top-level-value.json5 +5 -0
  65. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-with-asterisks.json5 +7 -0
  66. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-following-array-element.json5 +3 -0
  67. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-following-top-level-value.json5 +1 -0
  68. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-in-string.json +1 -0
  69. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-preceding-top-level-value.json5 +2 -0
  70. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/top-level-block-comment.txt +4 -0
  71. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/top-level-inline-comment.txt +1 -0
  72. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/unterminated-block-comment.txt +5 -0
  73. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/empty.txt +0 -0
  74. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/npm-package.json +106 -0
  75. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/npm-package.json5 +106 -0
  76. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/readme-example.json5 +23 -0
  77. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/decimal-literal-with-exponent.json +1 -0
  78. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/decimal-literal-with-negative-exponent.json +1 -0
  79. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/decimal-literal.json +1 -0
  80. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal-with-lowercase-letter.json5 +1 -0
  81. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal-with-no-digits.txt +1 -0
  82. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal-with-uppercase-x.json5 +1 -0
  83. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal.json5 +1 -0
  84. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/leading-decimal-point.json5 +1 -0
  85. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/negative-decimal-literal.json +1 -0
  86. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/negative-hexadecimal-literal.json5 +1 -0
  87. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/negative-leading-decimal-point.json5 +1 -0
  88. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/noctal-literal-with-octal-digit-after-leading-zero.js +1 -0
  89. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/noctal-literal.js +1 -0
  90. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/octal-literal.txt +1 -0
  91. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/trailing-decimal-point-with-exponent.js +1 -0
  92. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/trailing-decimal-point.js +1 -0
  93. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/zero-literal.json +1 -0
  94. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/empty-object.json +1 -0
  95. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-number.txt +3 -0
  96. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-symbol.txt +3 -0
  97. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/leading-comma-object.txt +3 -0
  98. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/lone-trailing-comma-object.txt +3 -0
  99. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/no-comma-object.txt +4 -0
  100. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/reserved-unquoted-key.json5 +3 -0
  101. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/single-quoted-key.json5 +3 -0
  102. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/trailing-comma-object.json5 +3 -0
  103. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/unquoted-keys.json5 +8 -0
  104. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/strings/escaped-single-quoted-string.json5 +1 -0
  105. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/strings/multi-line-string.json5 +2 -0
  106. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/strings/single-quoted-string.json5 +1 -0
  107. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/todo/unicode-escaped-unquoted-key.json5 +3 -0
  108. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/todo/unicode-unquoted-key.json5 +3 -0
  109. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/parse.js +74 -0
  110. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/readme.md +23 -0
  111. data/node_modules/exports-loader/node_modules/loader-utils/node_modules/json5/test/require.js +18 -0
  112. data/node_modules/exports-loader/node_modules/loader-utils/package.json +54 -0
  113. data/node_modules/exports-loader/node_modules/loader-utils/test/index.js +62 -0
  114. data/node_modules/exports-loader/node_modules/source-map/.npmignore +2 -0
  115. data/node_modules/exports-loader/node_modules/source-map/.travis.yml +4 -0
  116. data/node_modules/exports-loader/node_modules/source-map/CHANGELOG.md +194 -0
  117. data/node_modules/exports-loader/node_modules/source-map/LICENSE +28 -0
  118. data/node_modules/exports-loader/node_modules/source-map/Makefile.dryice.js +166 -0
  119. data/node_modules/exports-loader/node_modules/source-map/README.md +475 -0
  120. data/node_modules/exports-loader/node_modules/source-map/build/assert-shim.js +56 -0
  121. data/node_modules/exports-loader/node_modules/source-map/build/mini-require.js +152 -0
  122. data/node_modules/exports-loader/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  123. data/node_modules/exports-loader/node_modules/source-map/build/prefix-utils.jsm +18 -0
  124. data/node_modules/exports-loader/node_modules/source-map/build/suffix-browser.js +8 -0
  125. data/node_modules/exports-loader/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  126. data/node_modules/exports-loader/node_modules/source-map/build/suffix-utils.jsm +21 -0
  127. data/node_modules/exports-loader/node_modules/source-map/build/test-prefix.js +8 -0
  128. data/node_modules/exports-loader/node_modules/source-map/build/test-suffix.js +3 -0
  129. data/node_modules/exports-loader/node_modules/source-map/lib/source-map.js +8 -0
  130. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/array-set.js +97 -0
  131. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/base64-vlq.js +142 -0
  132. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/base64.js +42 -0
  133. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/binary-search.js +80 -0
  134. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/mapping-list.js +86 -0
  135. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/source-map-consumer.js +575 -0
  136. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/source-map-generator.js +400 -0
  137. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/source-node.js +414 -0
  138. data/node_modules/exports-loader/node_modules/source-map/lib/source-map/util.js +319 -0
  139. data/node_modules/exports-loader/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  140. data/node_modules/exports-loader/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  141. data/node_modules/exports-loader/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  142. data/node_modules/exports-loader/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
  143. data/node_modules/exports-loader/node_modules/source-map/node_modules/amdefine/package.json +37 -0
  144. data/node_modules/exports-loader/node_modules/source-map/package.json +186 -0
  145. data/node_modules/exports-loader/node_modules/source-map/test/run-tests.js +62 -0
  146. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-api.js +26 -0
  147. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-array-set.js +104 -0
  148. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-base64-vlq.js +23 -0
  149. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-base64.js +35 -0
  150. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  151. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-dog-fooding.js +84 -0
  152. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-source-map-consumer.js +702 -0
  153. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-source-map-generator.js +679 -0
  154. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-source-node.js +612 -0
  155. data/node_modules/exports-loader/node_modules/source-map/test/source-map/test-util.js +216 -0
  156. data/node_modules/exports-loader/node_modules/source-map/test/source-map/util.js +192 -0
  157. data/node_modules/exports-loader/package.json +46 -0
  158. data/node_modules/imports-loader/.npmignore +1 -0
  159. data/node_modules/imports-loader/README.md +17 -0
  160. data/node_modules/imports-loader/index.js +46 -0
  161. data/node_modules/imports-loader/node_modules/loader-utils/.npmignore +1 -0
  162. data/node_modules/imports-loader/node_modules/loader-utils/README.md +129 -0
  163. data/node_modules/imports-loader/node_modules/loader-utils/index.js +229 -0
  164. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/.bin/json5 +41 -0
  165. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/.npmignore +0 -0
  166. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/LICENCE +23 -0
  167. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/README.md +214 -0
  168. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/big.js +1026 -0
  169. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/big.min.js +1 -0
  170. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/doc/bigAPI.html +1026 -0
  171. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/package.json +61 -0
  172. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/big-vs-bigdecimal.html +678 -0
  173. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/bigtime.js +324 -0
  174. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/BigDecTest.class +0 -0
  175. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/BigDecTest.java +60 -0
  176. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/LICENCE.txt +205 -0
  177. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/bigdecimal.js +592 -0
  178. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_GWT/bugs.js +53 -0
  179. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js +5724 -0
  180. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js +61 -0
  181. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/perf/lib/bigdecimal_ICU4J/LICENCE.txt +30 -0
  182. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/abs.js +555 -0
  183. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/browser/big-vs-number.html +249 -0
  184. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/browser/every-test.html +66 -0
  185. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/browser/single-test.html +26 -0
  186. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/cmp.js +4305 -0
  187. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/div.js +9978 -0
  188. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/every-test.js +31 -0
  189. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/minus.js +1793 -0
  190. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/mod.js +1838 -0
  191. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/plus.js +1916 -0
  192. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/pow.js +1233 -0
  193. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/round.js +5173 -0
  194. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/sqrt.js +788 -0
  195. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/times.js +2159 -0
  196. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/toExponential.js +472 -0
  197. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/toFixed.js +1030 -0
  198. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/toPrecision.js +508 -0
  199. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/big.js/test/toString.js +1068 -0
  200. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/.npmignore +4 -0
  201. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/CHANGELOG.md +56 -0
  202. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/Makefile +27 -0
  203. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/README.md +173 -0
  204. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/lib/cli.js +41 -0
  205. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/lib/json5.js +462 -0
  206. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/lib/require.js +18 -0
  207. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/package.json +66 -0
  208. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/package.json5 +24 -0
  209. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/empty-array.json +1 -0
  210. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/leading-comma-array.js +3 -0
  211. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/lone-trailing-comma-array.js +3 -0
  212. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/no-comma-array.txt +4 -0
  213. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/regular-array.json +5 -0
  214. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/arrays/trailing-comma-array.json5 +3 -0
  215. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-following-array-element.json5 +6 -0
  216. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-following-top-level-value.json5 +5 -0
  217. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-in-string.json +1 -0
  218. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-preceding-top-level-value.json5 +5 -0
  219. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/block-comment-with-asterisks.json5 +7 -0
  220. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-following-array-element.json5 +3 -0
  221. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-following-top-level-value.json5 +1 -0
  222. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-in-string.json +1 -0
  223. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/inline-comment-preceding-top-level-value.json5 +2 -0
  224. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/top-level-block-comment.txt +4 -0
  225. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/top-level-inline-comment.txt +1 -0
  226. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/comments/unterminated-block-comment.txt +5 -0
  227. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/empty.txt +0 -0
  228. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/npm-package.json +106 -0
  229. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/npm-package.json5 +106 -0
  230. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/misc/readme-example.json5 +23 -0
  231. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/decimal-literal-with-exponent.json +1 -0
  232. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/decimal-literal-with-negative-exponent.json +1 -0
  233. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/decimal-literal.json +1 -0
  234. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal-with-lowercase-letter.json5 +1 -0
  235. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal-with-no-digits.txt +1 -0
  236. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal-with-uppercase-x.json5 +1 -0
  237. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/hexadecimal-literal.json5 +1 -0
  238. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/leading-decimal-point.json5 +1 -0
  239. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/negative-decimal-literal.json +1 -0
  240. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/negative-hexadecimal-literal.json5 +1 -0
  241. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/negative-leading-decimal-point.json5 +1 -0
  242. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/noctal-literal-with-octal-digit-after-leading-zero.js +1 -0
  243. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/noctal-literal.js +1 -0
  244. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/octal-literal.txt +1 -0
  245. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/trailing-decimal-point-with-exponent.js +1 -0
  246. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/trailing-decimal-point.js +1 -0
  247. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/numbers/zero-literal.json +1 -0
  248. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/empty-object.json +1 -0
  249. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-number.txt +3 -0
  250. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-symbol.txt +3 -0
  251. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/leading-comma-object.txt +3 -0
  252. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/lone-trailing-comma-object.txt +3 -0
  253. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/no-comma-object.txt +4 -0
  254. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/reserved-unquoted-key.json5 +3 -0
  255. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/single-quoted-key.json5 +3 -0
  256. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/trailing-comma-object.json5 +3 -0
  257. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/objects/unquoted-keys.json5 +8 -0
  258. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/strings/escaped-single-quoted-string.json5 +1 -0
  259. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/strings/multi-line-string.json5 +2 -0
  260. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/strings/single-quoted-string.json5 +1 -0
  261. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/todo/unicode-escaped-unquoted-key.json5 +3 -0
  262. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse-cases/todo/unicode-unquoted-key.json5 +3 -0
  263. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/parse.js +74 -0
  264. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/readme.md +23 -0
  265. data/node_modules/imports-loader/node_modules/loader-utils/node_modules/json5/test/require.js +18 -0
  266. data/node_modules/imports-loader/node_modules/loader-utils/package.json +53 -0
  267. data/node_modules/imports-loader/node_modules/loader-utils/test/index.js +62 -0
  268. data/node_modules/imports-loader/node_modules/source-map/.npmignore +2 -0
  269. data/node_modules/imports-loader/node_modules/source-map/.travis.yml +4 -0
  270. data/node_modules/imports-loader/node_modules/source-map/CHANGELOG.md +194 -0
  271. data/node_modules/imports-loader/node_modules/source-map/LICENSE +28 -0
  272. data/node_modules/imports-loader/node_modules/source-map/Makefile.dryice.js +166 -0
  273. data/node_modules/imports-loader/node_modules/source-map/README.md +475 -0
  274. data/node_modules/imports-loader/node_modules/source-map/build/assert-shim.js +56 -0
  275. data/node_modules/imports-loader/node_modules/source-map/build/mini-require.js +152 -0
  276. data/node_modules/imports-loader/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  277. data/node_modules/imports-loader/node_modules/source-map/build/prefix-utils.jsm +18 -0
  278. data/node_modules/imports-loader/node_modules/source-map/build/suffix-browser.js +8 -0
  279. data/node_modules/imports-loader/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  280. data/node_modules/imports-loader/node_modules/source-map/build/suffix-utils.jsm +21 -0
  281. data/node_modules/imports-loader/node_modules/source-map/build/test-prefix.js +8 -0
  282. data/node_modules/imports-loader/node_modules/source-map/build/test-suffix.js +3 -0
  283. data/node_modules/imports-loader/node_modules/source-map/lib/source-map.js +8 -0
  284. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/array-set.js +97 -0
  285. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/base64-vlq.js +142 -0
  286. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/base64.js +42 -0
  287. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/binary-search.js +80 -0
  288. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/mapping-list.js +86 -0
  289. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/source-map-consumer.js +575 -0
  290. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/source-map-generator.js +400 -0
  291. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/source-node.js +414 -0
  292. data/node_modules/imports-loader/node_modules/source-map/lib/source-map/util.js +319 -0
  293. data/node_modules/imports-loader/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  294. data/node_modules/imports-loader/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  295. data/node_modules/imports-loader/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  296. data/node_modules/imports-loader/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
  297. data/node_modules/imports-loader/node_modules/source-map/node_modules/amdefine/package.json +37 -0
  298. data/node_modules/imports-loader/node_modules/source-map/package.json +186 -0
  299. data/node_modules/imports-loader/node_modules/source-map/test/run-tests.js +62 -0
  300. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-api.js +26 -0
  301. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-array-set.js +104 -0
  302. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-base64-vlq.js +23 -0
  303. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-base64.js +35 -0
  304. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  305. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-dog-fooding.js +84 -0
  306. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-source-map-consumer.js +702 -0
  307. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-source-map-generator.js +679 -0
  308. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-source-node.js +612 -0
  309. data/node_modules/imports-loader/node_modules/source-map/test/source-map/test-util.js +216 -0
  310. data/node_modules/imports-loader/node_modules/source-map/test/source-map/util.js +192 -0
  311. data/node_modules/imports-loader/package.json +46 -0
  312. data/package.json +4 -2
  313. data/webpack.config.js +3 -6
  314. metadata +312 -5
  315. data/app/assets/javascripts/vendor/jquery.js +0 -10346
@@ -0,0 +1,23 @@
1
+ The MIT Expat Licence.
2
+
3
+ Copyright (c) 2012 Michael Mclaughlin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
@@ -0,0 +1,214 @@
1
+
2
+ # big.js #
3
+
4
+ A small, fast JavaScript library for arbitrary-precision decimal arithmetic.
5
+
6
+ The little sister to [bignumber.js](https://github.com/MikeMcl/bignumber.js/).
7
+ See also [decimal.js](https://github.com/MikeMcl/decimal.js/).
8
+
9
+ ## Features
10
+
11
+ - Faster, smaller and easier-to-use than JavaScript versions of Java's BigDecimal
12
+ - Only 2.6 KB minified and gzipped
13
+ - Simple API
14
+ - Replicates the `toExponential`, `toFixed` and `toPrecision` methods of JavaScript's Number type
15
+ - Includes a `sqrt` method
16
+ - Stores values in an accessible decimal floating point format
17
+ - No dependencies
18
+ - Comprehensive [documentation](http://mikemcl.github.io/big.js/) and test set
19
+
20
+ ## Load
21
+
22
+ The library is the single JavaScript file *big.js* (or *big.min.js*, which is *big.js* minified).
23
+
24
+ It can be loaded via a script tag in an HTML document for the browser
25
+
26
+ <script src='./relative/path/to/big.js'></script>
27
+
28
+ or as a CommonJS, [Node.js](http://nodejs.org) or AMD module using `require`.
29
+
30
+ For Node, put the *big.js* file into the same directory as the file that is requiring it and use
31
+
32
+ var Big = require('./big.js');
33
+
34
+ or put it in a *node_modules* directory within the directory and use `require('big.js')`.
35
+
36
+ To load with AMD loader libraries such as [requireJS](http://requirejs.org/):
37
+
38
+ require(['big'], function(Big) {
39
+ // Use Big here in local scope. No global Big.
40
+ });
41
+
42
+ ## Use
43
+
44
+ *In all examples below, `var`, semicolons and `toString` calls are not shown.
45
+ If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
46
+
47
+ The library exports a single function: Big, the constructor of Big number instances.
48
+ It accepts a value of type Number, String or Big number Object.
49
+
50
+ x = new Big(123.4567)
51
+ y = Big('123456.7e-3') // 'new' is optional
52
+ z = new Big(x)
53
+ x.eq(y) && x.eq(z) && y.eq(z) // true
54
+
55
+ A Big number is immutable in the sense that it is not changed by its methods.
56
+
57
+ 0.3 - 0.1 // 0.19999999999999998
58
+ x = new Big(0.3)
59
+ x.minus(0.1) // "0.2"
60
+ x // "0.3"
61
+
62
+ The methods that return a Big number can be chained.
63
+
64
+ x.div(y).plus(z).times(9).minus('1.234567801234567e+8').plus(976.54321).div('2598.11772')
65
+ x.sqrt().div(y).pow(3).gt(y.mod(z)) // true
66
+
67
+ Like JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods.
68
+
69
+ x = new Big(255.5)
70
+ x.toExponential(5) // "2.55500e+2"
71
+ x.toFixed(5) // "255.50000"
72
+ x.toPrecision(5) // "255.50"
73
+
74
+ The maximum number of decimal places and the rounding mode used to round the results of the `div`, `sqrt` and `pow`
75
+ (with negative exponent) methods is determined by the value of the `DP` and `RM` properties of the `Big` number constructor.
76
+ The other methods always give the exact result.
77
+
78
+ Big.DP = 10
79
+ Big.RM = 1
80
+
81
+ x = new Big(2);
82
+ y = new Big(3);
83
+ z = x.div(y) // "0.6666666667"
84
+ z.sqrt() // "0.8164965809"
85
+ z.pow(-3) // "3.3749999995"
86
+ z.times(z) // "0.44444444448888888889"
87
+ z.times(z).round(10) // "0.4444444445"
88
+
89
+ The value of a Big number is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
90
+
91
+ x = new Big(-123.456);
92
+ x.c // "1,2,3,4,5,6" coefficient (i.e. significand)
93
+ x.e // 2 exponent
94
+ x.s // -1 sign
95
+
96
+ For further information see the [API](http://mikemcl.github.io/big.js/) reference from the *doc* folder.
97
+
98
+ ## Test
99
+
100
+ The *test* directory contains the test scripts for each Big number method.
101
+
102
+ The tests can be run with Node or a browser.
103
+
104
+ To test a single method, from a command-line shell at the *test* directory, use e.g.
105
+
106
+ $ node toFixed
107
+
108
+ To test all the methods
109
+
110
+ $ node every-test
111
+
112
+ For the browser, see *single-test.html* and *every-test.html* in the *test/browser* directory.
113
+
114
+ *big-vs-number.html* enables some of the methods of big.js to be compared with those of JavaScript's Number type.
115
+
116
+ ## Performance
117
+
118
+ The *perf* directory contains two applications and a *lib* directory containing the BigDecimal libraries used by both.
119
+
120
+ *big-vs-bigdecimal.html* tests the performance of big.js against the JavaScript translations of two versions of BigDecimal, its use should be more or less self-explanatory.
121
+ (The GWT version doesn't work in IE 6.)
122
+
123
+ * GWT: java.math.BigDecimal
124
+ <https://github.com/iriscouch/bigdecimal.js>
125
+ * ICU4J: com.ibm.icu.math.BigDecimal
126
+ <https://github.com/dtrebbien/BigDecimal.js>
127
+
128
+ The BigDecimal in Node's npm registry is the GWT version. Despite its seeming popularity I have found it to have some serious bugs, see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods.
129
+
130
+ *bigtime.js* is a Node command-line application which tests the performance of big.js against the GWT version of
131
+ BigDecimal from the npm registry.
132
+
133
+ For example, to compare the time taken by the big.js `plus` method and the BigDecimal `add` method:
134
+
135
+ $ node bigtime plus 10000 40
136
+
137
+ This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match.
138
+
139
+ For help:
140
+
141
+ $ node bigtime -h
142
+
143
+ ## Build
144
+
145
+ I.e. minify.
146
+
147
+ For Node, if uglify-js is installed globally ( `npm install uglify-js -g` ) then
148
+
149
+ uglifyjs -o ./big.min.js ./big.js
150
+
151
+ will create *big.min.js*.
152
+
153
+ The *big.min.js* already present was created with *Microsoft Ajax Minifier 4.95*, as it produced a smaller file size.
154
+
155
+ ## Feedback
156
+
157
+ Feedback is welcome.
158
+
159
+ Bugs/comments/questions?
160
+ Open an issue, or email
161
+
162
+ Michael
163
+ <a href="mailto:M8ch88l@gmail.com">M8ch88l@gmail.com</a>
164
+
165
+ Bitcoin donation to:
166
+ **1DppGRQSjVSMgGxuygDEHQuWEdTiVEzJYG**
167
+ Thank you
168
+
169
+ ## Licence
170
+
171
+ See LICENCE.
172
+
173
+ ## Change Log
174
+
175
+ ####2.5.1
176
+
177
+ * 8/06/14 Amend README requires.
178
+
179
+ ####2.5.0
180
+
181
+ * 26/01/14 Added `toJSON` method so serialization uses `toString`.
182
+
183
+ ####2.4.1
184
+
185
+ * 17/10/13 Conform signed zero to IEEEE 754 (2008).
186
+
187
+ ####2.4.0
188
+
189
+ * 19/09/13 Throw instances of `Error`.
190
+
191
+ ####2.3.0
192
+
193
+ * 16/09/13 Added `cmp` method.
194
+
195
+ ####2.2.0
196
+
197
+ * 11/07/13 Added 'round up' mode.
198
+
199
+ ####2.1.0
200
+
201
+ * 26/06/13 Allow e.g. `.1` and `2.`.
202
+
203
+ ####2.0.0
204
+
205
+ * 12/05/13 Added `abs` method and replaced `cmp` with `eq`, `gt`, `gte`, `lt`, and `lte` methods.
206
+
207
+ ####1.0.1
208
+
209
+ * Changed default value of MAX_DP to 1E6
210
+
211
+ ####1.0.0
212
+
213
+ * 7/11/2012 Initial release
214
+
@@ -0,0 +1,1026 @@
1
+ /* big.js v2.5.1 https://github.com/MikeMcl/big.js/LICENCE */
2
+ ;(function ( global ) {
3
+ 'use strict';
4
+
5
+ /*
6
+ big.js v2.5.1
7
+ A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
8
+ https://github.com/MikeMcl/big.js/
9
+ Copyright (c) 2012 Michael Mclaughlin <M8ch88l@gmail.com>
10
+ MIT Expat Licence
11
+ */
12
+
13
+ /****************************** EDITABLE DEFAULTS **********************************/
14
+
15
+
16
+ // The default values below must be integers within the stated ranges (inclusive).
17
+
18
+ /*
19
+ * The maximum number of decimal places of the results of methods involving
20
+ * division, i.e. 'div' and 'sqrt', and 'pow' with negative exponents.
21
+ */
22
+ Big['DP'] = 20; // 0 to MAX_DP
23
+
24
+ /*
25
+ * The rounding mode used when rounding to the above decimal places.
26
+ *
27
+ * 0 Round towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
28
+ * 1 Round to nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
29
+ * 2 Round to nearest neighbour. If equidistant, to even neighbour. (ROUND_HALF_EVEN)
30
+ * 3 Round away from zero. (ROUND_UP)
31
+ */
32
+ Big['RM'] = 1; // 0, 1, 2 or 3
33
+
34
+ // The maximum value of 'Big.DP'.
35
+ var MAX_DP = 1E6, // 0 to 1e+6
36
+
37
+ // The maximum magnitude of the exponent argument to the 'pow' method.
38
+ MAX_POWER = 1E6, // 1 to 1e+6
39
+
40
+ /*
41
+ * The exponent value at and beneath which 'toString' returns exponential notation.
42
+ * Javascript's Number type: -7
43
+ * -1e+6 is the minimum recommended exponent value of a Big.
44
+ */
45
+ TO_EXP_NEG = -7, // 0 to -1e+6
46
+
47
+ /*
48
+ * The exponent value at and above which 'toString' returns exponential notation.
49
+ * Javascript's Number type: 21
50
+ * 1e+6 is the maximum recommended exponent value of a Big, though there is no
51
+ * enforcing or checking of a limit.
52
+ */
53
+ TO_EXP_POS = 21, // 0 to 1e+6
54
+
55
+
56
+ /***********************************************************************************/
57
+
58
+ P = Big.prototype,
59
+ isValid = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
60
+ ONE = new Big(1);
61
+
62
+
63
+ // CONSTRUCTOR
64
+
65
+
66
+ /*
67
+ * The exported function.
68
+ * Create and return a new instance of a Big object.
69
+ *
70
+ * n {number|string|Big} A numeric value.
71
+ */
72
+ function Big( n ) {
73
+ var i, j, nL,
74
+ x = this;
75
+
76
+ // Enable constructor usage without new.
77
+ if ( !(x instanceof Big) ) {
78
+ return new Big( n )
79
+ }
80
+
81
+ // Duplicate.
82
+ if ( n instanceof Big ) {
83
+ x['s'] = n['s'];
84
+ x['e'] = n['e'];
85
+ x['c'] = n['c'].slice();
86
+ return
87
+ }
88
+
89
+ // Minus zero?
90
+ if ( n === 0 && 1 / n < 0 ) {
91
+ n = '-0'
92
+ // Ensure 'n' is string and check validity.
93
+ } else if ( !isValid.test(n += '') ) {
94
+ throwErr( NaN )
95
+ }
96
+
97
+ // Determine sign.
98
+ x['s'] = n.charAt(0) == '-' ? ( n = n.slice(1), -1 ) : 1;
99
+
100
+ // Decimal point?
101
+ if ( ( i = n.indexOf('.') ) > -1 ) {
102
+ n = n.replace( '.', '' )
103
+ }
104
+
105
+ // Exponential form?
106
+ if ( ( j = n.search(/e/i) ) > 0 ) {
107
+
108
+ // Determine exponent.
109
+ if ( i < 0 ) {
110
+ i = j
111
+ }
112
+ i += +n.slice( j + 1 );
113
+ n = n.substring( 0, j )
114
+
115
+ } else if ( i < 0 ) {
116
+
117
+ // Integer.
118
+ i = n.length
119
+ }
120
+
121
+ // Determine leading zeros.
122
+ for ( j = 0; n.charAt(j) == '0'; j++ ) {
123
+ }
124
+
125
+ if ( j == ( nL = n.length ) ) {
126
+
127
+ // Zero.
128
+ x['c'] = [ x['e'] = 0 ]
129
+ } else {
130
+
131
+ // Determine trailing zeros.
132
+ for ( ; n.charAt(--nL) == '0'; ) {
133
+ }
134
+
135
+ x['e'] = i - j - 1;
136
+ x['c'] = [];
137
+
138
+ // Convert string to array of digits (without leading and trailing zeros).
139
+ for ( i = 0; j <= nL; x['c'][i++] = +n.charAt(j++) ) {
140
+ }
141
+ }
142
+ }
143
+
144
+
145
+ // PRIVATE FUNCTIONS
146
+
147
+
148
+ /*
149
+ * Round Big 'x' to a maximum of 'dp' decimal places using rounding mode
150
+ * 'rm'. (Called by 'div', 'sqrt' and 'round'.)
151
+ *
152
+ * x {Big} The Big to round.
153
+ * dp {number} Integer, 0 to MAX_DP inclusive.
154
+ * rm {number} 0, 1, 2 or 3 ( ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP )
155
+ * [more] {boolean} Whether the result of division was truncated.
156
+ */
157
+ function rnd( x, dp, rm, more ) {
158
+ var xc = x['c'],
159
+ i = x['e'] + dp + 1;
160
+
161
+ if ( rm === 1 ) {
162
+ // 'xc[i]' is the digit after the digit that may be rounded up.
163
+ more = xc[i] >= 5
164
+ } else if ( rm === 2 ) {
165
+ more = xc[i] > 5 || xc[i] == 5 && ( more || i < 0 || xc[i + 1] != null || xc[i - 1] & 1 )
166
+ } else if ( rm === 3 ) {
167
+ more = more || xc[i] != null || i < 0
168
+ } else if ( more = false, rm !== 0 ) {
169
+ throwErr( '!Big.RM!' )
170
+ }
171
+
172
+ if ( i < 1 || !xc[0] ) {
173
+ x['c'] = more
174
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
175
+ ? ( x['e'] = -dp, [1] )
176
+ // Zero.
177
+ : [ x['e'] = 0 ];
178
+ } else {
179
+
180
+ // Remove any digits after the required decimal places.
181
+ xc.length = i--;
182
+
183
+ // Round up?
184
+ if ( more ) {
185
+
186
+ // Rounding up may mean the previous digit has to be rounded up and so on.
187
+ for ( ; ++xc[i] > 9; ) {
188
+ xc[i] = 0;
189
+
190
+ if ( !i-- ) {
191
+ ++x['e'];
192
+ xc.unshift(1)
193
+ }
194
+ }
195
+ }
196
+
197
+ // Remove trailing zeros.
198
+ for ( i = xc.length; !xc[--i]; xc.pop() ) {
199
+ }
200
+ }
201
+
202
+ return x
203
+ }
204
+
205
+
206
+ /*
207
+ * Throw a BigError.
208
+ *
209
+ * message {string} The error message.
210
+ */
211
+ function throwErr( message ) {
212
+ var err = new Error( message );
213
+ err['name'] = 'BigError';
214
+
215
+ throw err
216
+ }
217
+
218
+
219
+ // PROTOTYPE/INSTANCE METHODS
220
+
221
+
222
+ /*
223
+ * Return a new Big whose value is the absolute value of this Big.
224
+ */
225
+ P['abs'] = function () {
226
+ var x = new Big(this);
227
+ x['s'] = 1;
228
+
229
+ return x
230
+ };
231
+
232
+
233
+ /*
234
+ * Return
235
+ * 1 if the value of this 'Big' is greater than the value of 'Big' 'y',
236
+ * -1 if the value of this 'Big' is less than the value of 'Big' 'y', or
237
+ * 0 if they have the same value.
238
+ */
239
+ P['cmp'] = function ( y ) {
240
+ var xNeg,
241
+ x = this,
242
+ xc = x['c'],
243
+ yc = ( y = new Big( y ) )['c'],
244
+ i = x['s'],
245
+ j = y['s'],
246
+ k = x['e'],
247
+ l = y['e'];
248
+
249
+ // Either zero?
250
+ if ( !xc[0] || !yc[0] ) {
251
+ return !xc[0] ? !yc[0] ? 0 : -j : i
252
+ }
253
+
254
+ // Signs differ?
255
+ if ( i != j ) {
256
+ return i
257
+ }
258
+ xNeg = i < 0;
259
+
260
+ // Compare exponents.
261
+ if ( k != l ) {
262
+ return k > l ^ xNeg ? 1 : -1
263
+ }
264
+
265
+ // Compare digit by digit.
266
+ for ( i = -1,
267
+ j = ( k = xc.length ) < ( l = yc.length ) ? k : l;
268
+ ++i < j; ) {
269
+
270
+ if ( xc[i] != yc[i] ) {
271
+ return xc[i] > yc[i] ^ xNeg ? 1 : -1
272
+ }
273
+ }
274
+
275
+ // Compare lengths.
276
+ return k == l ? 0 : k > l ^ xNeg ? 1 : -1
277
+ };
278
+
279
+
280
+ /*
281
+ * Return a new Big whose value is the value of this Big divided by the
282
+ * value of Big 'y', rounded, if necessary, to a maximum of 'Big.DP'
283
+ * decimal places using rounding mode 'Big.RM'.
284
+ */
285
+ P['div'] = function ( y ) {
286
+ var x = this,
287
+ dvd = x['c'],
288
+ dvs = ( y = new Big(y) )['c'],
289
+ s = x['s'] == y['s'] ? 1 : -1,
290
+ dp = Big['DP'];
291
+
292
+ if ( dp !== ~~dp || dp < 0 || dp > MAX_DP ) {
293
+ throwErr( '!Big.DP!' )
294
+ }
295
+
296
+ // Either 0?
297
+ if ( !dvd[0] || !dvs[0] ) {
298
+
299
+ // Both 0?
300
+ if ( dvd[0] == dvs[0] ) {
301
+ throwErr( NaN )
302
+ }
303
+
304
+ // 'dvs' is 0?
305
+ if ( !dvs[0] ) {
306
+ // Throw +-Infinity.
307
+ throwErr( s / 0 )
308
+ }
309
+
310
+ // 'dvd' is 0. Return +-0.
311
+ return new Big( s * 0 )
312
+ }
313
+
314
+ var dvsL, dvsT, next, cmp, remI,
315
+ dvsZ = dvs.slice(),
316
+ dvdI = dvsL = dvs.length,
317
+ dvdL = dvd.length,
318
+ rem = dvd.slice( 0, dvsL ),
319
+ remL = rem.length,
320
+ quo = new Big(ONE),
321
+ qc = quo['c'] = [],
322
+ qi = 0,
323
+ digits = dp + ( quo['e'] = x['e'] - y['e'] ) + 1;
324
+
325
+ quo['s'] = s;
326
+ s = digits < 0 ? 0 : digits;
327
+
328
+ // Create version of divisor with leading zero.
329
+ dvsZ.unshift(0);
330
+
331
+ // Add zeros to make remainder as long as divisor.
332
+ for ( ; remL++ < dvsL; rem.push(0) ) {
333
+ }
334
+
335
+ do {
336
+
337
+ // 'next' is how many times the divisor goes into the current remainder.
338
+ for ( next = 0; next < 10; next++ ) {
339
+
340
+ // Compare divisor and remainder.
341
+ if ( dvsL != ( remL = rem.length ) ) {
342
+ cmp = dvsL > remL ? 1 : -1
343
+ } else {
344
+ for ( remI = -1, cmp = 0; ++remI < dvsL; ) {
345
+
346
+ if ( dvs[remI] != rem[remI] ) {
347
+ cmp = dvs[remI] > rem[remI] ? 1 : -1;
348
+ break
349
+ }
350
+ }
351
+ }
352
+
353
+ // Subtract divisor from remainder (if divisor < remainder).
354
+ if ( cmp < 0 ) {
355
+
356
+ // Remainder cannot be more than one digit longer than divisor.
357
+ // Equalise lengths using divisor with extra leading zero?
358
+ for ( dvsT = remL == dvsL ? dvs : dvsZ; remL; ) {
359
+
360
+ if ( rem[--remL] < dvsT[remL] ) {
361
+
362
+ for ( remI = remL;
363
+ remI && !rem[--remI];
364
+ rem[remI] = 9 ) {
365
+ }
366
+ --rem[remI];
367
+ rem[remL] += 10
368
+ }
369
+ rem[remL] -= dvsT[remL]
370
+ }
371
+ for ( ; !rem[0]; rem.shift() ) {
372
+ }
373
+ } else {
374
+ break
375
+ }
376
+ }
377
+
378
+ // Add the 'next' digit to the result array.
379
+ qc[qi++] = cmp ? next : ++next;
380
+
381
+ // Update the remainder.
382
+ rem[0] && cmp
383
+ ? ( rem[remL] = dvd[dvdI] || 0 )
384
+ : ( rem = [ dvd[dvdI] ] )
385
+
386
+ } while ( ( dvdI++ < dvdL || rem[0] != null ) && s-- );
387
+
388
+ // Leading zero? Do not remove if result is simply zero (qi == 1).
389
+ if ( !qc[0] && qi != 1) {
390
+
391
+ // There can't be more than one zero.
392
+ qc.shift();
393
+ quo['e']--;
394
+ }
395
+
396
+ // Round?
397
+ if ( qi > digits ) {
398
+ rnd( quo, dp, Big['RM'], rem[0] != null )
399
+ }
400
+
401
+ return quo
402
+ }
403
+
404
+
405
+ /*
406
+ * Return true if the value of this Big is equal to the value of Big 'y',
407
+ * otherwise returns false.
408
+ */
409
+ P['eq'] = function ( y ) {
410
+ return !this.cmp( y )
411
+ };
412
+
413
+
414
+ /*
415
+ * Return true if the value of this Big is greater than the value of Big 'y',
416
+ * otherwise returns false.
417
+ */
418
+ P['gt'] = function ( y ) {
419
+ return this.cmp( y ) > 0
420
+ };
421
+
422
+
423
+ /*
424
+ * Return true if the value of this Big is greater than or equal to the
425
+ * value of Big 'y', otherwise returns false.
426
+ */
427
+ P['gte'] = function ( y ) {
428
+ return this.cmp( y ) > -1
429
+ };
430
+
431
+
432
+ /*
433
+ * Return true if the value of this Big is less than the value of Big 'y',
434
+ * otherwise returns false.
435
+ */
436
+ P['lt'] = function ( y ) {
437
+ return this.cmp( y ) < 0
438
+ };
439
+
440
+
441
+ /*
442
+ * Return true if the value of this Big is less than or equal to the value
443
+ * of Big 'y', otherwise returns false.
444
+ */
445
+ P['lte'] = function ( y ) {
446
+ return this.cmp( y ) < 1
447
+ };
448
+
449
+
450
+ /*
451
+ * Return a new Big whose value is the value of this Big minus the value
452
+ * of Big 'y'.
453
+ */
454
+ P['minus'] = function ( y ) {
455
+ var d, i, j, xLTy,
456
+ x = this,
457
+ a = x['s'],
458
+ b = ( y = new Big( y ) )['s'];
459
+
460
+ // Signs differ?
461
+ if ( a != b ) {
462
+ return y['s'] = -b, x['plus'](y)
463
+ }
464
+
465
+ var xc = x['c'].slice(),
466
+ xe = x['e'],
467
+ yc = y['c'],
468
+ ye = y['e'];
469
+
470
+ // Either zero?
471
+ if ( !xc[0] || !yc[0] ) {
472
+
473
+ // 'y' is non-zero?
474
+ return yc[0]
475
+ ? ( y['s'] = -b, y )
476
+ // 'x' is non-zero?
477
+ : new Big( xc[0]
478
+ ? x
479
+ // Both are zero.
480
+ : 0 )
481
+ }
482
+
483
+ // Determine which is the bigger number.
484
+ // Prepend zeros to equalise exponents.
485
+ if ( a = xe - ye ) {
486
+ d = ( xLTy = a < 0 ) ? ( a = -a, xc ) : ( ye = xe, yc );
487
+
488
+ for ( d.reverse(), b = a; b--; d.push(0) ) {
489
+ }
490
+ d.reverse()
491
+ } else {
492
+
493
+ // Exponents equal. Check digit by digit.
494
+ j = ( ( xLTy = xc.length < yc.length ) ? xc : yc ).length;
495
+
496
+ for ( a = b = 0; b < j; b++ ) {
497
+
498
+ if ( xc[b] != yc[b] ) {
499
+ xLTy = xc[b] < yc[b];
500
+ break
501
+ }
502
+ }
503
+ }
504
+
505
+ // 'x' < 'y'? Point 'xc' to the array of the bigger number.
506
+ if ( xLTy ) {
507
+ d = xc, xc = yc, yc = d;
508
+ y['s'] = -y['s']
509
+ }
510
+
511
+ /*
512
+ * Append zeros to 'xc' if shorter. No need to add zeros to 'yc' if shorter
513
+ * as subtraction only needs to start at 'yc.length'.
514
+ */
515
+ if ( ( b = -( ( j = xc.length ) - yc.length ) ) > 0 ) {
516
+
517
+ for ( ; b--; xc[j++] = 0 ) {
518
+ }
519
+ }
520
+
521
+ // Subtract 'yc' from 'xc'.
522
+ for ( b = yc.length; b > a; ){
523
+
524
+ if ( xc[--b] < yc[b] ) {
525
+
526
+ for ( i = b; i && !xc[--i]; xc[i] = 9 ) {
527
+ }
528
+ --xc[i];
529
+ xc[b] += 10
530
+ }
531
+ xc[b] -= yc[b]
532
+ }
533
+
534
+ // Remove trailing zeros.
535
+ for ( ; xc[--j] == 0; xc.pop() ) {
536
+ }
537
+
538
+ // Remove leading zeros and adjust exponent accordingly.
539
+ for ( ; xc[0] == 0; xc.shift(), --ye ) {
540
+ }
541
+
542
+ if ( !xc[0] ) {
543
+
544
+ // n - n = +0
545
+ y['s'] = 1;
546
+
547
+ // Result must be zero.
548
+ xc = [ye = 0]
549
+ }
550
+
551
+ return y['c'] = xc, y['e'] = ye, y
552
+ };
553
+
554
+
555
+ /*
556
+ * Return a new Big whose value is the value of this Big modulo the
557
+ * value of Big 'y'.
558
+ */
559
+ P['mod'] = function ( y ) {
560
+ y = new Big( y );
561
+ var c,
562
+ x = this,
563
+ i = x['s'],
564
+ j = y['s'];
565
+
566
+ if ( !y['c'][0] ) {
567
+ throwErr( NaN )
568
+ }
569
+
570
+ x['s'] = y['s'] = 1;
571
+ c = y.cmp( x ) == 1;
572
+ x['s'] = i, y['s'] = j;
573
+
574
+ return c
575
+ ? new Big(x)
576
+ : ( i = Big['DP'], j = Big['RM'],
577
+ Big['DP'] = Big['RM'] = 0,
578
+ x = x['div'](y),
579
+ Big['DP'] = i, Big['RM'] = j,
580
+ this['minus']( x['times'](y) ) )
581
+ };
582
+
583
+
584
+ /*
585
+ * Return a new Big whose value is the value of this Big plus the value
586
+ * of Big 'y'.
587
+ */
588
+ P['plus'] = function ( y ) {
589
+ var d,
590
+ x = this,
591
+ a = x['s'],
592
+ b = ( y = new Big( y ) )['s'];
593
+
594
+ // Signs differ?
595
+ if ( a != b ) {
596
+ return y['s'] = -b, x['minus'](y)
597
+ }
598
+
599
+ var xe = x['e'],
600
+ xc = x['c'],
601
+ ye = y['e'],
602
+ yc = y['c'];
603
+
604
+ // Either zero?
605
+ if ( !xc[0] || !yc[0] ) {
606
+
607
+ // 'y' is non-zero?
608
+ return yc[0]
609
+ ? y
610
+ : new Big( xc[0]
611
+
612
+ // 'x' is non-zero?
613
+ ? x
614
+
615
+ // Both are zero. Return zero.
616
+ : a * 0 )
617
+ }
618
+
619
+ // Prepend zeros to equalise exponents.
620
+ // Note: Faster to use reverse then do unshifts.
621
+ if ( xc = xc.slice(), a = xe - ye ) {
622
+ d = a > 0 ? ( ye = xe, yc ) : ( a = -a, xc );
623
+
624
+ for ( d.reverse(); a--; d.push(0) ) {
625
+ }
626
+ d.reverse()
627
+ }
628
+
629
+ // Point 'xc' to the longer array.
630
+ if ( xc.length - yc.length < 0 ) {
631
+ d = yc, yc = xc, xc = d
632
+ }
633
+
634
+ /*
635
+ * Only start adding at 'yc.length - 1' as the
636
+ * further digits of 'xc' can be left as they are.
637
+ */
638
+ for ( a = yc.length, b = 0; a;
639
+ b = ( xc[--a] = xc[a] + yc[a] + b ) / 10 ^ 0, xc[a] %= 10 ) {
640
+ }
641
+
642
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
643
+
644
+ if ( b ) {
645
+ xc.unshift(b);
646
+ ++ye
647
+ }
648
+
649
+ // Remove trailing zeros.
650
+ for ( a = xc.length; xc[--a] == 0; xc.pop() ) {
651
+ }
652
+
653
+ return y['c'] = xc, y['e'] = ye, y
654
+ };
655
+
656
+
657
+ /*
658
+ * Return a Big whose value is the value of this Big raised to the power
659
+ * 'e'. If 'e' is negative, round, if necessary, to a maximum of 'Big.DP'
660
+ * decimal places using rounding mode 'Big.RM'.
661
+ *
662
+ * e {number} Integer, -MAX_POWER to MAX_POWER inclusive.
663
+ */
664
+ P['pow'] = function ( e ) {
665
+ var isNeg = e < 0,
666
+ x = new Big(this),
667
+ y = ONE;
668
+
669
+ if ( e !== ~~e || e < -MAX_POWER || e > MAX_POWER ) {
670
+ throwErr( '!pow!' )
671
+ }
672
+
673
+ for ( e = isNeg ? -e : e; ; ) {
674
+
675
+ if ( e & 1 ) {
676
+ y = y['times'](x)
677
+ }
678
+ e >>= 1;
679
+
680
+ if ( !e ) {
681
+ break
682
+ }
683
+ x = x['times'](x)
684
+ }
685
+
686
+ return isNeg ? ONE['div'](y) : y
687
+ };
688
+
689
+
690
+ /*
691
+ * Return a new Big whose value is the value of this Big rounded, if
692
+ * necessary, to a maximum of 'dp' decimal places using rounding mode 'rm'.
693
+ * If 'dp' is not specified, round to 0 decimal places.
694
+ * If 'rm' is not specified, use 'Big.RM'.
695
+ *
696
+ * [dp] {number} Integer, 0 to MAX_DP inclusive.
697
+ * [rm] 0, 1, 2 or 3 ( ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP )
698
+ */
699
+ P['round'] = function ( dp, rm ) {
700
+ var x = new Big(this);
701
+
702
+ if ( dp == null ) {
703
+ dp = 0
704
+ } else if ( dp !== ~~dp || dp < 0 || dp > MAX_DP ) {
705
+ throwErr( '!round!' )
706
+ }
707
+ rnd( x, dp, rm == null ? Big['RM'] : rm );
708
+
709
+ return x
710
+ };
711
+
712
+
713
+ /*
714
+ * Return a new Big whose value is the square root of the value of this
715
+ * Big, rounded, if necessary, to a maximum of 'Big.DP' decimal places
716
+ * using rounding mode 'Big.RM'.
717
+ */
718
+ P['sqrt'] = function () {
719
+ var estimate, r, approx,
720
+ x = this,
721
+ xc = x['c'],
722
+ i = x['s'],
723
+ e = x['e'],
724
+ half = new Big('0.5');
725
+
726
+ // Zero?
727
+ if ( !xc[0] ) {
728
+ return new Big(x)
729
+ }
730
+
731
+ // Negative?
732
+ if ( i < 0 ) {
733
+ throwErr( NaN )
734
+ }
735
+
736
+ // Estimate.
737
+ i = Math.sqrt( x.toString() );
738
+
739
+ // Math.sqrt underflow/overflow?
740
+ // Pass 'x' to Math.sqrt as integer, then adjust the exponent of the result.
741
+ if ( i == 0 || i == 1 / 0 ) {
742
+ estimate = xc.join('');
743
+
744
+ if ( !( estimate.length + e & 1 ) ) {
745
+ estimate += '0'
746
+ }
747
+
748
+ r = new Big( Math.sqrt(estimate).toString() );
749
+ r['e'] = ( ( ( e + 1 ) / 2 ) | 0 ) - ( e < 0 || e & 1 )
750
+ } else {
751
+ r = new Big( i.toString() )
752
+ }
753
+
754
+ i = r['e'] + ( Big['DP'] += 4 );
755
+
756
+ // Newton-Raphson loop.
757
+ do {
758
+ approx = r;
759
+ r = half['times']( approx['plus']( x['div'](approx) ) )
760
+ } while ( approx['c'].slice( 0, i ).join('') !==
761
+ r['c'].slice( 0, i ).join('') );
762
+
763
+ rnd( r, Big['DP'] -= 4, Big['RM'] );
764
+
765
+ return r
766
+ };
767
+
768
+
769
+ /*
770
+ * Return a new Big whose value is the value of this Big times the value
771
+ * of Big 'y'.
772
+ */
773
+ P['times'] = function ( y ) {
774
+ var c,
775
+ x = this,
776
+ xc = x['c'],
777
+ yc = ( y = new Big( y ) )['c'],
778
+ a = xc.length,
779
+ b = yc.length,
780
+ i = x['e'],
781
+ j = y['e'];
782
+
783
+ y['s'] = x['s'] == y['s'] ? 1 : -1;
784
+
785
+ // Either 0?
786
+ if ( !xc[0] || !yc[0] ) {
787
+
788
+ return new Big( y['s'] * 0 )
789
+ }
790
+
791
+ y['e'] = i + j;
792
+
793
+ if ( a < b ) {
794
+ c = xc, xc = yc, yc = c, j = a, a = b, b = j
795
+ }
796
+
797
+ for ( j = a + b, c = []; j--; c.push(0) ) {
798
+ }
799
+
800
+ // Multiply!
801
+ for ( i = b - 1; i > -1; i-- ) {
802
+
803
+ for ( b = 0, j = a + i;
804
+ j > i;
805
+ b = c[j] + yc[i] * xc[j - i - 1] + b,
806
+ c[j--] = b % 10 | 0,
807
+ b = b / 10 | 0 ) {
808
+ }
809
+
810
+ if ( b ) {
811
+ c[j] = ( c[j] + b ) % 10
812
+ }
813
+ }
814
+
815
+ b && ++y['e'];
816
+
817
+ // Remove any leading zero.
818
+ !c[0] && c.shift();
819
+
820
+ // Remove trailing zeros.
821
+ for ( j = c.length; !c[--j]; c.pop() ) {
822
+ }
823
+
824
+ return y['c'] = c, y
825
+ };
826
+
827
+
828
+ /*
829
+ * Return a string representing the value of this Big.
830
+ * Return exponential notation if this Big has a positive exponent equal
831
+ * to or greater than 'TO_EXP_POS', or a negative exponent equal to or less
832
+ * than 'TO_EXP_NEG'.
833
+ */
834
+ P['toString'] = P['valueOf'] = P['toJSON'] = function () {
835
+ var x = this,
836
+ e = x['e'],
837
+ str = x['c'].join(''),
838
+ strL = str.length;
839
+
840
+ // Exponential notation?
841
+ if ( e <= TO_EXP_NEG || e >= TO_EXP_POS ) {
842
+ str = str.charAt(0) + ( strL > 1 ? '.' + str.slice(1) : '' ) +
843
+ ( e < 0 ? 'e' : 'e+' ) + e
844
+
845
+ // Negative exponent?
846
+ } else if ( e < 0 ) {
847
+
848
+ // Prepend zeros.
849
+ for ( ; ++e; str = '0' + str ) {
850
+ }
851
+ str = '0.' + str
852
+
853
+ // Positive exponent?
854
+ } else if ( e > 0 ) {
855
+
856
+ if ( ++e > strL ) {
857
+
858
+ // Append zeros.
859
+ for ( e -= strL; e-- ; str += '0' ) {
860
+ }
861
+ } else if ( e < strL ) {
862
+ str = str.slice( 0, e ) + '.' + str.slice(e)
863
+ }
864
+
865
+ // Exponent zero.
866
+ } else if ( strL > 1 ) {
867
+ str = str.charAt(0) + '.' + str.slice(1)
868
+ }
869
+
870
+ // Avoid '-0'
871
+ return x['s'] < 0 && x['c'][0] ? '-' + str : str
872
+ };
873
+
874
+
875
+ /*
876
+ ***************************************************************************
877
+ * If 'toExponential', 'toFixed', 'toPrecision' and 'format' are not
878
+ * required they can safely be commented-out or deleted. No redundant code
879
+ * will be left. 'format' is used only by 'toExponential', 'toFixed' and
880
+ * 'toPrecision'.
881
+ ***************************************************************************
882
+ */
883
+
884
+
885
+ /*
886
+ * PRIVATE FUNCTION
887
+ *
888
+ * Return a string representing the value of Big 'x' in normal or
889
+ * exponential notation to a fixed number of decimal places or significant
890
+ * digits 'dp'.
891
+ * (Called by toString, toExponential, toFixed and toPrecision.)
892
+ *
893
+ * x {Big} The Big to format.
894
+ * dp {number} Integer, 0 to MAX_DP inclusive.
895
+ * toE {number} undefined (toFixed), 1 (toExponential) or 2 (toPrecision).
896
+ */
897
+ function format( x, dp, toE ) {
898
+ // The index (in normal notation) of the digit that may be rounded up.
899
+ var i = dp - ( x = new Big(x) )['e'],
900
+ c = x['c'];
901
+
902
+ // Round?
903
+ if ( c.length > ++dp ) {
904
+ rnd( x, i, Big['RM'] )
905
+ }
906
+
907
+ // Recalculate 'i' if toFixed as 'x.e' may have changed if value rounded up.
908
+ i = !c[0] ? i + 1 : toE ? dp : ( c = x['c'], x['e'] + i + 1 );
909
+
910
+ // Append zeros?
911
+ for ( ; c.length < i; c.push(0) ) {
912
+ }
913
+ i = x['e'];
914
+
915
+ /*
916
+ * 'toPrecision' returns exponential notation if the number of
917
+ * significant digits specified is less than the number of digits
918
+ * necessary to represent the integer part of the value in normal
919
+ * notation.
920
+ */
921
+ return toE == 1 || toE == 2 && ( dp <= i || i <= TO_EXP_NEG )
922
+
923
+ // Exponential notation.
924
+ ? ( x['s'] < 0 && c[0] ? '-' : '' ) + ( c.length > 1
925
+ ? ( c.splice( 1, 0, '.' ), c.join('') )
926
+ : c[0] ) + ( i < 0 ? 'e' : 'e+' ) + i
927
+
928
+ // Normal notation.
929
+ : x.toString()
930
+ }
931
+
932
+
933
+ /*
934
+ * Return a string representing the value of this Big in exponential
935
+ * notation to 'dp' fixed decimal places and rounded, if necessary, using
936
+ * 'Big.RM'.
937
+ *
938
+ * [dp] {number} Integer, 0 to MAX_DP inclusive.
939
+ */
940
+ P['toExponential'] = function ( dp ) {
941
+
942
+ if ( dp == null ) {
943
+ dp = this['c'].length - 1
944
+ } else if ( dp !== ~~dp || dp < 0 || dp > MAX_DP ) {
945
+ throwErr( '!toExp!' )
946
+ }
947
+
948
+ return format( this, dp, 1 )
949
+ };
950
+
951
+
952
+ /*
953
+ * Return a string representing the value of this Big in normal notation
954
+ * to 'dp' fixed decimal places and rounded, if necessary, using 'Big.RM'.
955
+ *
956
+ * [dp] {number} Integer, 0 to MAX_DP inclusive.
957
+ */
958
+ P['toFixed'] = function ( dp ) {
959
+ var str,
960
+ x = this,
961
+ neg = TO_EXP_NEG,
962
+ pos = TO_EXP_POS;
963
+
964
+ TO_EXP_NEG = -( TO_EXP_POS = 1 / 0 );
965
+
966
+ if ( dp == null ) {
967
+ str = x.toString()
968
+ } else if ( dp === ~~dp && dp >= 0 && dp <= MAX_DP ) {
969
+ str = format( x, x['e'] + dp );
970
+
971
+ // (-0).toFixed() is '0', but (-0.1).toFixed() is '-0'.
972
+ // (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
973
+ if ( x['s'] < 0 && x['c'][0] && str.indexOf('-') < 0 ) {
974
+ // As e.g. -0.5 if rounded to -0 will cause toString to omit the minus sign.
975
+ str = '-' + str
976
+ }
977
+ }
978
+ TO_EXP_NEG = neg, TO_EXP_POS = pos;
979
+
980
+ if ( !str ) {
981
+ throwErr( '!toFix!' )
982
+ }
983
+
984
+ return str
985
+ };
986
+
987
+
988
+ /*
989
+ * Return a string representing the value of this Big to 'sd' significant
990
+ * digits and rounded, if necessary, using 'Big.RM'. If 'sd' is less than
991
+ * the number of digits necessary to represent the integer part of the value
992
+ * in normal notation, then use exponential notation.
993
+ *
994
+ * sd {number} Integer, 1 to MAX_DP inclusive.
995
+ */
996
+ P['toPrecision'] = function ( sd ) {
997
+
998
+ if ( sd == null ) {
999
+ return this.toString()
1000
+ } else if ( sd !== ~~sd || sd < 1 || sd > MAX_DP ) {
1001
+ throwErr( '!toPre!' )
1002
+ }
1003
+
1004
+ return format( this, sd - 1, 2 )
1005
+ };
1006
+
1007
+
1008
+ // EXPORT
1009
+
1010
+
1011
+ // Node and other CommonJS-like environments that support module.exports.
1012
+ if ( typeof module !== 'undefined' && module.exports ) {
1013
+ module.exports = Big
1014
+
1015
+ //AMD.
1016
+ } else if ( typeof define == 'function' && define.amd ) {
1017
+ define( function () {
1018
+ return Big
1019
+ })
1020
+
1021
+ //Browser.
1022
+ } else {
1023
+ global['Big'] = Big
1024
+ }
1025
+
1026
+ })( this );