long-decimal 0.00.22 → 0.01.00

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 (159) hide show
  1. data/README +157 -32
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/doc/classes/LongDecimal.src/M000036.html +1 -1
  5. data/doc/classes/LongDecimal.src/M000037.html +1 -1
  6. data/doc/classes/LongDecimal.src/M000038.html +1 -1
  7. data/doc/classes/LongDecimal.src/M000039.html +1 -1
  8. data/doc/classes/LongDecimal.src/M000040.html +1 -1
  9. data/doc/classes/LongDecimal.src/M000041.html +1 -1
  10. data/doc/classes/LongDecimal.src/M000042.html +1 -1
  11. data/doc/classes/LongDecimal.src/M000043.html +1 -1
  12. data/doc/classes/LongDecimal.src/M000044.html +1 -1
  13. data/doc/classes/LongDecimal.src/M000045.html +1 -1
  14. data/doc/classes/LongDecimal.src/M000046.html +1 -1
  15. data/doc/classes/LongDecimal.src/M000047.html +1 -1
  16. data/doc/classes/LongDecimal.src/M000048.html +1 -1
  17. data/doc/classes/LongDecimal.src/M000049.html +1 -1
  18. data/doc/classes/LongDecimal.src/M000050.html +1 -1
  19. data/doc/classes/LongDecimal.src/M000051.html +1 -1
  20. data/doc/classes/LongDecimal.src/M000052.html +1 -1
  21. data/doc/classes/LongDecimal.src/M000053.html +1 -1
  22. data/doc/classes/LongDecimal.src/M000054.html +1 -1
  23. data/doc/classes/LongDecimal.src/M000055.html +1 -1
  24. data/doc/classes/LongDecimal.src/M000056.html +1 -1
  25. data/doc/classes/LongDecimal.src/M000057.html +1 -1
  26. data/doc/classes/LongDecimal.src/M000058.html +1 -1
  27. data/doc/classes/LongDecimal.src/M000059.html +1 -1
  28. data/doc/classes/LongDecimal.src/M000060.html +1 -1
  29. data/doc/classes/LongDecimal.src/M000062.html +1 -1
  30. data/doc/classes/LongDecimal.src/M000063.html +1 -1
  31. data/doc/classes/LongDecimal.src/M000064.html +1 -1
  32. data/doc/classes/LongDecimal.src/M000065.html +1 -1
  33. data/doc/classes/LongDecimal.src/M000066.html +1 -1
  34. data/doc/classes/LongDecimal.src/M000067.html +1 -1
  35. data/doc/classes/LongDecimal.src/M000068.html +1 -1
  36. data/doc/classes/LongDecimal.src/M000069.html +1 -1
  37. data/doc/classes/LongDecimal.src/M000070.html +1 -1
  38. data/doc/classes/LongDecimal.src/M000071.html +6 -2
  39. data/doc/classes/LongDecimal.src/M000072.html +1 -1
  40. data/doc/classes/LongDecimal.src/M000073.html +1 -1
  41. data/doc/classes/LongDecimal.src/M000074.html +1 -1
  42. data/doc/classes/LongDecimal.src/M000075.html +1 -1
  43. data/doc/classes/LongDecimal.src/M000076.html +1 -1
  44. data/doc/classes/LongDecimal.src/M000077.html +1 -1
  45. data/doc/classes/LongDecimal.src/M000078.html +1 -1
  46. data/doc/classes/LongDecimal.src/M000079.html +1 -1
  47. data/doc/classes/LongDecimal.src/M000080.html +1 -1
  48. data/doc/classes/LongDecimal.src/M000081.html +1 -1
  49. data/doc/classes/LongDecimal.src/M000082.html +1 -1
  50. data/doc/classes/LongDecimal.src/M000083.html +1 -1
  51. data/doc/classes/LongDecimal.src/M000084.html +1 -1
  52. data/doc/classes/LongDecimal.src/M000085.html +1 -1
  53. data/doc/classes/LongDecimal.src/M000086.html +1 -1
  54. data/doc/classes/LongDecimal.src/M000087.html +1 -1
  55. data/doc/classes/LongDecimal.src/M000088.html +1 -1
  56. data/doc/classes/LongDecimal.src/M000089.html +1 -1
  57. data/doc/classes/LongDecimal.src/M000090.html +1 -1
  58. data/doc/classes/LongDecimal.src/M000091.html +1 -1
  59. data/doc/classes/LongDecimal.src/M000092.html +1 -1
  60. data/doc/classes/LongDecimal.src/M000093.html +1 -1
  61. data/doc/classes/LongDecimal.src/M000094.html +1 -1
  62. data/doc/classes/LongDecimal.src/M000095.html +1 -1
  63. data/doc/classes/LongDecimal.src/M000098.html +1 -1
  64. data/doc/classes/LongDecimal.src/M000099.html +1 -1
  65. data/doc/classes/LongDecimal.src/M000100.html +1 -1
  66. data/doc/classes/LongDecimal.src/M000101.html +1 -1
  67. data/doc/classes/LongDecimal.src/M000102.html +18 -0
  68. data/doc/classes/LongDecimal.src/M000103.html +18 -0
  69. data/doc/classes/LongDecimalBase.src/M000107.html +1 -1
  70. data/doc/classes/LongDecimalBase.src/M000108.html +1 -1
  71. data/doc/classes/LongDecimalBase.src/M000109.html +1 -1
  72. data/doc/classes/LongDecimalBase.src/M000110.html +1 -1
  73. data/doc/classes/LongDecimalBase.src/M000111.html +1 -1
  74. data/doc/classes/LongDecimalBase.src/M000112.html +1 -1
  75. data/doc/classes/LongDecimalBase.src/M000115.html +1 -1
  76. data/doc/classes/LongDecimalBase.src/M000116.html +19 -0
  77. data/doc/classes/LongDecimalBase.src/M000117.html +18 -0
  78. data/doc/classes/LongDecimalQuot.src/M000003.html +1 -1
  79. data/doc/classes/LongDecimalQuot.src/M000004.html +1 -1
  80. data/doc/classes/LongDecimalQuot.src/M000005.html +1 -1
  81. data/doc/classes/LongDecimalQuot.src/M000006.html +1 -1
  82. data/doc/classes/LongDecimalQuot.src/M000007.html +1 -1
  83. data/doc/classes/LongDecimalQuot.src/M000008.html +1 -1
  84. data/doc/classes/LongDecimalQuot.src/M000009.html +1 -1
  85. data/doc/classes/LongDecimalQuot.src/M000010.html +1 -1
  86. data/doc/classes/LongDecimalQuot.src/M000011.html +1 -1
  87. data/doc/classes/LongDecimalQuot.src/M000012.html +1 -1
  88. data/doc/classes/LongDecimalQuot.src/M000013.html +13 -2
  89. data/doc/classes/LongDecimalQuot.src/M000014.html +1 -1
  90. data/doc/classes/LongDecimalQuot.src/M000015.html +1 -1
  91. data/doc/classes/LongDecimalQuot.src/M000016.html +1 -1
  92. data/doc/classes/LongDecimalQuot.src/M000017.html +1 -1
  93. data/doc/classes/LongDecimalQuot.src/M000018.html +1 -1
  94. data/doc/classes/LongDecimalQuot.src/M000019.html +1 -1
  95. data/doc/classes/LongDecimalQuot.src/M000020.html +1 -1
  96. data/doc/classes/LongDecimalQuot.src/M000021.html +1 -1
  97. data/doc/classes/LongDecimalQuot.src/M000022.html +1 -1
  98. data/doc/classes/LongDecimalQuot.src/M000023.html +1 -1
  99. data/doc/classes/LongDecimalQuot.src/M000024.html +1 -1
  100. data/doc/classes/LongDecimalQuot.src/M000025.html +18 -1
  101. data/doc/classes/LongDecimalQuot.src/M000026.html +1 -1
  102. data/doc/classes/LongDecimalQuot.src/M000027.html +1 -1
  103. data/doc/classes/LongDecimalQuot.src/M000028.html +1 -1
  104. data/doc/classes/LongDecimalQuot.src/M000029.html +1 -1
  105. data/doc/classes/LongDecimalQuot.src/M000030.html +18 -0
  106. data/doc/classes/LongDecimalQuot.src/M000031.html +18 -0
  107. data/doc/classes/LongDecimalQuot.src/M000034.html +18 -0
  108. data/doc/classes/LongDecimalQuot.src/M000035.html +18 -0
  109. data/doc/classes/LongDecimalRoundingMode.html +17 -2
  110. data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.html +17 -2
  111. data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000150.html +22 -0
  112. data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000151.html +18 -0
  113. data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000152.html +18 -0
  114. data/doc/classes/LongMath.src/M000118.html +1 -1
  115. data/doc/classes/LongMath.src/M000119.html +1 -1
  116. data/doc/classes/LongMath.src/M000120.html +1 -1
  117. data/doc/classes/LongMath.src/M000121.html +1 -1
  118. data/doc/classes/LongMath.src/M000122.html +1 -1
  119. data/doc/classes/LongMath.src/M000123.html +1 -1
  120. data/doc/classes/LongMath.src/M000124.html +1 -1
  121. data/doc/classes/LongMath.src/M000125.html +1 -1
  122. data/doc/classes/LongMath.src/M000126.html +1 -1
  123. data/doc/classes/LongMath.src/M000127.html +1 -1
  124. data/doc/classes/LongMath.src/M000128.html +1 -1
  125. data/doc/classes/LongMath.src/M000129.html +1 -1
  126. data/doc/classes/LongMath.src/M000130.html +1 -1
  127. data/doc/classes/LongMath.src/M000131.html +1 -1
  128. data/doc/classes/LongMath.src/M000132.html +1 -1
  129. data/doc/classes/LongMath.src/M000133.html +1 -1
  130. data/doc/classes/LongMath.src/M000134.html +1 -1
  131. data/doc/classes/LongMath.src/M000135.html +1 -1
  132. data/doc/classes/LongMath.src/M000136.html +1 -1
  133. data/doc/classes/LongMath.src/M000137.html +11 -3
  134. data/doc/classes/LongMath.src/M000138.html +2 -1
  135. data/doc/classes/LongMath.src/M000139.html +1 -1
  136. data/doc/classes/LongMath.src/M000140.html +1 -1
  137. data/doc/classes/LongMath.src/M000141.html +1 -1
  138. data/doc/classes/LongMath.src/M000142.html +2 -2
  139. data/doc/classes/LongMath.src/M000143.html +2 -2
  140. data/doc/classes/LongMath.src/M000144.html +3 -2
  141. data/doc/classes/LongMath.src/M000145.html +20 -10
  142. data/doc/classes/LongMath.src/M000146.html +3 -2
  143. data/doc/classes/LongMath.src/M000147.html +80 -0
  144. data/doc/classes/LongMath.src/M000148.html +63 -0
  145. data/doc/classes/LongMath/CacheKey.src/M000149.html +36 -0
  146. data/doc/classes/Numeric.src/M000104.html +23 -0
  147. data/doc/classes/Numeric.src/M000105.html +18 -0
  148. data/doc/classes/Rational.src/M000106.html +23 -0
  149. data/doc/created.rid +1 -1
  150. data/doc/files/lib/long-decimal_rb.html +189 -0
  151. data/doc/files/lib/long-decimal_rb.src/M000001.html +1 -1
  152. data/doc/files/lib/long-decimal_rb.src/M000002.html +1 -1
  153. data/doc/fr_method_index.html +20 -19
  154. data/lib/long-decimal.rb +105 -30
  155. data/test/testlongdecimal.rb +448 -3
  156. data/test/testlongdeclib.rb +127 -28
  157. data/test/testrandom.rb +35 -22
  158. data/version.rb +4 -4
  159. metadata +20 -2
data/README CHANGED
@@ -1,31 +1,13 @@
1
1
  Version
2
2
  -------
3
3
 
4
- This version ($Name: PRE_ALPHA_0_22 $) is functionally identical with the previous
5
- pre-alpha-0.21. Some minor bugfixes have been made, because the
6
- exponential function sporadically showed a wrong result in having the
7
- last digit off by 1 from what would be the correct value. Some
8
- runit-tests have been added. A second runit-testing program that runs
9
- only tests of exponential function with random numbers for a long time
10
- has been added.
11
-
12
- There are no known bugs and this version can be considered complete in
13
- terms of functionality. This version is still a pre-alpha-version,
14
- but it is expected to move it to alpha within the next days of weeks,
15
- after having added some more tests and having fixed potential bugs
16
- that these tests might reveal. The first alpha version is not
17
- expected to be much different from this version. This version should
18
- already be usable. Operations +, -, *, / and sqrt should be working
19
- properly and would justify calling this release at least beta. Even
20
- log, exp and power should be fine, but they might have some issues in
21
- terms of precision, so that the last digits of the result might be
22
- wrong, or in terms of speed. For this reason they are currently
23
- considered to be alpha, as soon as significant amount testing with
24
- random numbers as parameters has been performed. It would be a good
25
- idea to do some mathematical analysis on how many digits are needed
26
- internally to guarantee the correctness of the digits that are
27
- provided. But this will not be considered as a requirement for the
28
- alpha-version.
4
+ This version ($Name: ALPHA_01_00 $) is functionally identical with the previous
5
+ pre-alpha-0.22. The runit tests have been extended and further tests
6
+ have been added. A lot of additional testing has been done using
7
+ random numbers as parameters with testrandom.rb and values for which
8
+ these random tests have failed have been added to the regular tests in
9
+ testlongdecimal.rb . So this release is mostly bug-fixing, enough to
10
+ justify declaring itself as alpha-version.
29
11
 
30
12
  This software development effort is hosted on RubyForge (
31
13
  http://rubyforge.org/ ) under the project name "long-decimal", to be
@@ -33,6 +15,26 @@ found directly with http://rubyforge.org/projects/long-decimal/ . So
33
15
  you should feel encouraged to look if there is a newer version, when
34
16
  you install long-decimal.
35
17
 
18
+ This version is a alpha-version. Operations +, -, *, / and sqrt
19
+ should be working properly and would justify calling this release at
20
+ least beta. Even log, exp and power should be fine. log, log2, log10
21
+ and exp have been tested for about a million random values and the
22
+ current version should cover all of these correctly. But it is still
23
+ possible,that in some cases the result deviates in the last digit by 1
24
+ or 2 from the real result. A deviation of slightly more than half of
25
+ the unit of the last digit is already present. Improving on this
26
+ would require an extensive extension of internal functionality to
27
+ provide rounding information in case of last digits being 50000...,
28
+ where additional digits would reveal if this really needs to be
29
+ rounded up or down. Because these functions are transcendental, at
30
+ least exp and log will always have either one of these true, it will
31
+ never be exactly ....5. Speed could be improved as well.
32
+
33
+ It would be a good idea to do some mathematical analysis on how many
34
+ digits are needed internally to guarantee the correctness of the
35
+ digits that are provided. But this will not be considered as a
36
+ requirement for the alpha-version.
37
+
36
38
  Test
37
39
  ----
38
40
 
@@ -48,8 +50,12 @@ your machine. It is about 15 minutes on my machine (1300 MHz).
48
50
  Whatever is gained by making the software run faster is used up again
49
51
  by adding more tests. This is the result of the test:
50
52
 
51
- Finished in 869.98785 seconds.
52
- 102 tests, 44345 assertions, 0 failures, 0 errors
53
+ In addition random tests for exp, log, log2 and log10 can be run for a
54
+ long time, using the script test/testrandom.rb. This requires
55
+ installation of the ruby-library crypt-isaac for its random numbers.
56
+ If you actually want to run this and find an error with it, please
57
+ report it with the lines of output revealing the bug on
58
+ http://rubyforge.org/projects/long-decimal/ -> tracker
53
59
 
54
60
  Install
55
61
  -------
@@ -100,7 +106,7 @@ ruby 1.8.4 and on Windows 2000 with ruby 1.8.2)
100
106
  - open a shell window
101
107
  cd to the directory where you have downloaded the gem-file
102
108
  unpack the file using tar
103
- tar xfzvv long-decimal-pre-alpha-0_17.tar.gz
109
+ tar xfzvv long-decimal-alpha-1_00.tar.gz
104
110
  cd long-decimal
105
111
  - now you can use rake for several operations
106
112
  - rake test
@@ -116,6 +122,125 @@ ruby 1.8.4 and on Windows 2000 with ruby 1.8.2)
116
122
  3. The documentation can be created from the sources. It is contained
117
123
  in the gem-file. It is not provided as a separate file any more.
118
124
 
125
+ Install
126
+ -------
127
+
128
+ (REMARK: installation has only been successfully tested on Linux with
129
+ ruby 1.8.4 and on Windows 2000 with ruby 1.8.2)
130
+
131
+ 1. Using ruby-gems (preferred)
132
+ - open a shell window
133
+ - become root, unless the current user has the right to install gems
134
+ (which is usually the case on windows)
135
+
136
+ su
137
+
138
+ - uninstall old versions
139
+
140
+ gem uninstall long-decimal
141
+
142
+ - install the newest version
143
+
144
+ gem install long-decimal
145
+
146
+ - Usage from your ruby-programs:
147
+
148
+ require "rubygems"
149
+ require_gem "long-decimal"
150
+
151
+ - documentation will be found in HTML-format in the directory
152
+ $RUBY_DIR/gems/$RUBY_VERSION/doc/long-decimal-$LONG_DECIMAL_VERSION/rdoc/index.html
153
+ where $RUBY_DIR is the directory containing your ruby-installation,
154
+ usually /usr/lib/ruby or /usr/local/lib/ruby on
155
+ Linux/Unix-systems.
156
+ $RUBY_VERSION is the major version of your Ruby, like 1.8
157
+ $LONG_DECIMAL_VERSION is the version of long-decimal that you
158
+ have installed, like 0.00.20
159
+ on my machine that would be
160
+ /usr/local/lib/ruby/gems/1.8/doc/long-decimal-0.00.20/rdoc/index.html
161
+
162
+ 2. Installing from the sources (it is preferred to use the
163
+ gem-installation, but since long-decimal is open-source-software you
164
+ are off course granted the right to download the source and change
165
+ it and install your own version.
166
+
167
+ - download the newest source-tar.gz-file from long-decimal project at rubyforge
168
+ which can be found by
169
+ http://rubyforge.org/projects/long-decimal/ -> Files
170
+ ( http://rubyforge.org/frs/?group_id=1334 )
171
+ - open a shell window
172
+ cd to the directory where you have downloaded the gem-file
173
+ unpack the file using tar
174
+ tar xfzvv long-decimal-alpha-1_00.tar.gz
175
+ cd long-decimal
176
+ - now you can use rake for several operations
177
+ - rake test
178
+ runs runit tests. All tests should succeed.
179
+ - rake doc
180
+ creates the documentation
181
+ - rake gem creates the gem-file in a sub-directory pkg
182
+ recommended for installation, proceed as in 1
183
+ - cd pkg
184
+ - gem install --local long-decimal
185
+
186
+
187
+ 3. The documentation can be created from the sources. It is contained
188
+ in the gem-file. It is not provided as a separate file any more.
189
+
190
+ Test
191
+ ----
192
+
193
+ Some runit tests have been included. They give some indication of the
194
+ correctness of this library and allow changes to be checked in order
195
+ to make sure that what was running before would still work afterwards.
196
+ Tests for a library as complex as long-decimal can never be
197
+ exhaustive, but they give a good indication that methods are working
198
+ correctly. About 95% of the tests that will be eventually needed are
199
+ already present. As a policy a release is not created unless all
200
+ tests succeed. Running the tests can take a few minutes, depending on
201
+ your machine. It is about 15 minutes on my machine (1300 MHz).
202
+ Whatever is gained by making the software run faster is used up again
203
+ by adding more tests. This is the result of the test:
204
+
205
+ Finished in 1735.081239 seconds.
206
+ 125 tests, 44932 assertions, 0 failures, 0 errors
207
+
208
+ Bugs
209
+ ----
210
+
211
+ There are no known bugs against the current specification and bugs
212
+ that occur are usually fixed within a few days.
213
+
214
+ It is considered somewhat arbitrary to disallow calculation
215
+ exponential functions if the result could not be expressed as Float.
216
+ This limitation should be removed, even though it has to be added,
217
+ that results of exponentiation that go beyond Float can only be handled
218
+ at a great cost of performance, because they really need more than 300
219
+ digits.
220
+
221
+ Certain calculations are too slow. Algorithms need to be optimized
222
+ for speed. The goal is to keep the algorithms in Ruby-code as long as
223
+ possible to make it easier to optimize the algorithm. If optimization
224
+ beyond this level will be needed, C-code might be used, preferably
225
+ based on an existing library.
226
+
227
+ Even though some mathematical background has already been invested,
228
+ more effort from the theoretical side is needed in order to choose
229
+ internal precision parameters in such a way that correctness of the
230
+ result to all given digits can be guaranteed with a minimum of
231
+ overhead. Currently parameters are probably slightly too careful,
232
+ which slows calculations down. But it is also possible that they are
233
+ insufficient for certain calculations, yielding wrong results.
234
+
235
+ rdoc-documentation and in-code comments are somewhat complete, but for
236
+ a sophisticated library like this additional external documentation
237
+ should be provided. Currently this does not exist at all.
238
+
239
+ Please report any bugs you come across on
240
+ http://rubyforge.org/projects/long-decimal -> Tracker.
241
+
242
+ The status of long-decimal is considered to be alpha.
243
+
119
244
  License
120
245
  -------
121
246
 
@@ -125,10 +250,10 @@ Find copies of these licenses on http://www.gnu.org/ or http://www.ruby-lang.org
125
250
  Warranty
126
251
  --------
127
252
 
128
- This is a pre-alpha-version. Do not expect too much! This is work in progress!
129
- I do not take any responsibility. Please use it as it is, change it
130
- according to the terms of the license or wait for a more stable
131
- version (for wich I can't take any warranty either...)
253
+ This is a alpha-version. Do not expect too much! This is work in
254
+ progress! I do not take any responsibility. Please use it as it is,
255
+ change it according to the terms of the license or wait for a more
256
+ stable version (for which I can't take any warranty either...)
132
257
 
133
258
  Author
134
259
  ------
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
  # Rakefile for long-decimal project
3
3
  #
4
4
  # CVS-ID: $Header: /var/cvs/long-decimal/long-decimal/Rakefile,v 1.3 2006/04/01 08:52:06 bk1 Exp $
5
- # CVS-Label: $Name: PRE_ALPHA_0_22 $
5
+ # CVS-Label: $Name: ALPHA_01_00 $
6
6
  # Author: $Author: bk1 $ (Karl Brodowsky)
7
7
  #
8
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.00.22
1
+ 0.01.00
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 188</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 207</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">new!</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-identifier">new</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">s</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 196</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 215</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">zero!</span>(<span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">s</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 205</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 224</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">one!</span>(<span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-identifier">new</span>(<span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-identifier">s</span>, <span class="ruby-identifier">s</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 214</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 233</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">two!</span>(<span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-identifier">new</span>(<span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-identifier">s</span>, <span class="ruby-identifier">s</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 223</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 242</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">ten!</span>(<span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-identifier">new</span>(<span class="ruby-value">10</span><span class="ruby-operator">**</span>(<span class="ruby-identifier">s</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>), <span class="ruby-identifier">s</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 232</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 251</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">minus_one!</span>(<span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-identifier">new</span>(<span class="ruby-value">-1</span><span class="ruby-operator">*</span><span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-identifier">s</span>, <span class="ruby-identifier">s</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 242</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 261</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimal</span>.<span class="ruby-identifier">power_of_ten!</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">s</span> = <span class="ruby-value">0</span>)
15
15
  <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">e</span>, <span class="ruby-value str">&quot;e&quot;</span>)
16
16
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;negative 1st arg \&quot;#{e.inspect}\&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 255</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 274</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">s</span>)
15
15
 
16
16
  <span class="ruby-comment cmt"># handle some obvious errors with x first</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 369</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 388</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scale=</span>(<span class="ruby-identifier">s</span>)
15
15
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;non integer arg \&quot;#{s.inspect}\&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>
16
16
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;negative arg \&quot;#{s.inspect}\&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 395</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 414</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">round_trailing_zeros</span>
15
15
  <span class="ruby-identifier">n</span> = <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">multiplicity_of_10</span>(<span class="ruby-identifier">int_val</span>)
16
16
  <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">n</span>.<span class="ruby-identifier">zero?</span>) <span class="ruby-keyword kw">then</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 414</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 433</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">round_to_scale</span>(<span class="ruby-identifier">new_scale</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-constant">ROUND_UNNECESSARY</span>)
15
15
 
16
16
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;new_scale #{new_scale.inspect} must be integer&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">new_scale</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 453</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 472</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">shown_scale</span> = <span class="ruby-ivar">@scale</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-constant">ROUND_UNNECESSARY</span>, <span class="ruby-identifier">base</span> = <span class="ruby-value">10</span>)
15
15
  <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">base</span> <span class="ruby-operator">==</span> <span class="ruby-value">10</span>) <span class="ruby-keyword kw">then</span>
16
16
  <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">shown_scale</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@scale</span>)
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 476</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 495</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s_10</span>
15
15
  <span class="ruby-identifier">to_s_internal</span>(<span class="ruby-value">10</span>, <span class="ruby-identifier">scale</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 483</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 502</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s_internal</span>(<span class="ruby-identifier">b</span>, <span class="ruby-identifier">sc</span>)
15
15
  <span class="ruby-identifier">sg</span> = <span class="ruby-identifier">sgn</span>
16
16
  <span class="ruby-identifier">i</span> = <span class="ruby-identifier">int_val</span>.<span class="ruby-identifier">abs</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 508</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 527</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_f</span>
15
15
  <span class="ruby-identifier">divisor</span> = <span class="ruby-identifier">denominator</span>
16
16
  <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">divisor</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-keyword kw">then</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 542</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 561</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span>
15
15
  <span class="ruby-identifier">numerator</span>.<span class="ruby-identifier">div</span>(<span class="ruby-identifier">denominator</span>)
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 551</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 570</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ld</span>(<span class="ruby-identifier">prec</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-constant">LongDecimal</span><span class="ruby-operator">::</span><span class="ruby-constant">ROUND_HALF_UP</span>)
15
15
  <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">prec</span>.<span class="ruby-identifier">nil?</span>)
16
16
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 562</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 581</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bd</span>
15
15
  <span class="ruby-comment cmt"># this operation is probably not used so heavily, so we can live with a</span>
16
16
  <span class="ruby-comment cmt"># string as an intermediate step.</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 576</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 595</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">denominator</span>
15
15
  <span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-identifier">scale</span>
16
16
  <span class="ruby-keyword kw">end</span></pre>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 598</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 617</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">int_digits2</span>
15
15
  <span class="ruby-identifier">int_part</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">abs</span>.<span class="ruby-identifier">to_i</span>
16
16
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">int_part</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">then</span>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 628</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 647</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sint_digits10</span>
15
15
  <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@digits10</span>.<span class="ruby-identifier">nil?</span>)
16
16
  <span class="ruby-ivar">@digits10</span> = <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">int_digits10</span>(<span class="ruby-identifier">int_val</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">scale</span>