long-decimal 0.00.11 → 0.00.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -3
- data/VERSION +1 -1
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.html +5 -5
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000133.html +22 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000135.html +22 -0
- data/doc/classes/LongMath.html +78 -29
- data/doc/classes/LongMath.src/M000001.html +1 -1
- data/doc/classes/LongMath.src/M000002.html +1 -1
- data/doc/classes/LongMath.src/M000003.html +1 -1
- data/doc/classes/LongMath.src/M000004.html +1 -1
- data/doc/classes/LongMath.src/M000005.html +1 -1
- data/doc/classes/LongMath.src/M000006.html +1 -1
- data/doc/classes/LongMath.src/M000007.html +1 -1
- data/doc/classes/LongMath.src/M000008.html +1 -1
- data/doc/classes/LongMath.src/M000009.html +1 -1
- data/doc/classes/LongMath.src/M000010.html +1 -1
- data/doc/classes/LongMath.src/M000011.html +2 -2
- data/doc/classes/LongMath.src/M000012.html +1 -1
- data/doc/classes/LongMath.src/M000013.html +1 -1
- data/doc/classes/LongMath.src/M000014.html +1 -1
- data/doc/classes/LongMath.src/M000015.html +1 -1
- data/doc/classes/LongMath.src/M000016.html +14 -11
- data/doc/classes/LongMath.src/M000017.html +10 -17
- data/doc/classes/LongMath.src/M000018.html +1 -1
- data/doc/classes/LongMath.src/M000019.html +2 -1
- data/doc/classes/LongMath.src/M000021.html +51 -1
- data/doc/classes/LongMath.src/M000022.html +12 -9
- data/doc/classes/LongMath.src/M000023.html +28 -5
- data/doc/classes/LongMath.src/M000024.html +22 -0
- data/doc/classes/LongMath.src/M000025.html +18 -0
- data/doc/classes/LongMath/LongDecimal.html +371 -371
- data/doc/classes/LongMath/LongDecimal.src/M000058.html +18 -0
- data/doc/classes/LongMath/LongDecimal.src/M000059.html +18 -0
- data/doc/classes/LongMath/LongDecimal.src/M000060.html +18 -0
- data/doc/classes/LongMath/LongDecimal.src/M000061.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000062.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000063.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000064.html +4 -6
- data/doc/classes/LongMath/LongDecimal.src/M000065.html +4 -95
- data/doc/classes/LongMath/LongDecimal.src/M000066.html +6 -20
- data/doc/classes/LongMath/LongDecimal.src/M000067.html +92 -24
- data/doc/classes/LongMath/LongDecimal.src/M000068.html +17 -18
- data/doc/classes/LongMath/LongDecimal.src/M000069.html +27 -4
- data/doc/classes/LongMath/LongDecimal.src/M000070.html +19 -13
- data/doc/classes/LongMath/LongDecimal.src/M000071.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000072.html +13 -22
- data/doc/classes/LongMath/LongDecimal.src/M000073.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000074.html +24 -4
- data/doc/classes/LongMath/LongDecimal.src/M000075.html +4 -6
- data/doc/classes/LongMath/LongDecimal.src/M000076.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000077.html +6 -15
- data/doc/classes/LongMath/LongDecimal.src/M000078.html +4 -32
- data/doc/classes/LongMath/LongDecimal.src/M000079.html +14 -14
- data/doc/classes/LongMath/LongDecimal.src/M000080.html +31 -12
- data/doc/classes/LongMath/LongDecimal.src/M000081.html +15 -4
- data/doc/classes/LongMath/LongDecimal.src/M000082.html +27 -0
- data/doc/classes/LongMath/LongDecimal.src/M000083.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000085.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000086.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000087.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000088.html +18 -0
- data/doc/classes/LongMath/LongDecimal.src/M000089.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000090.html +4 -8
- data/doc/classes/LongMath/LongDecimal.src/M000091.html +4 -9
- data/doc/classes/LongMath/LongDecimal.src/M000092.html +6 -7
- data/doc/classes/LongMath/LongDecimal.src/M000093.html +6 -6
- data/doc/classes/LongMath/LongDecimal.src/M000094.html +9 -4
- data/doc/classes/LongMath/LongDecimal.src/M000095.html +7 -13
- data/doc/classes/LongMath/LongDecimal.src/M000096.html +4 -9
- data/doc/classes/LongMath/LongDecimal.src/M000097.html +13 -7
- data/doc/classes/LongMath/LongDecimal.src/M000098.html +7 -18
- data/doc/classes/LongMath/LongDecimal.src/M000099.html +8 -7
- data/doc/classes/LongMath/LongDecimal.src/M000100.html +20 -5
- data/doc/classes/LongMath/LongDecimal.src/M000101.html +7 -8
- data/doc/classes/LongMath/LongDecimal.src/M000102.html +5 -9
- data/doc/classes/LongMath/LongDecimal.src/M000103.html +5 -5
- data/doc/classes/LongMath/LongDecimal.src/M000104.html +9 -4
- data/doc/classes/LongMath/LongDecimal.src/M000105.html +8 -6
- data/doc/classes/LongMath/LongDecimal.src/M000106.html +4 -7
- data/doc/classes/LongMath/LongDecimal.src/M000107.html +7 -4
- data/doc/classes/LongMath/LongDecimal.src/M000108.html +7 -4
- data/doc/classes/LongMath/LongDecimal.src/M000109.html +4 -9
- data/doc/classes/LongMath/LongDecimal.src/M000110.html +4 -9
- data/doc/classes/LongMath/LongDecimal.src/M000111.html +9 -5
- data/doc/classes/LongMath/LongDecimal.src/M000112.html +7 -7
- data/doc/classes/LongMath/LongDecimal.src/M000113.html +5 -4
- data/doc/classes/LongMath/LongDecimal.src/M000114.html +8 -15
- data/doc/classes/LongMath/LongDecimal.src/M000115.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000116.html +15 -8
- data/doc/classes/LongMath/LongDecimal.src/M000117.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000119.html +4 -9
- data/doc/classes/LongMath/LongDecimal.src/M000121.html +9 -4
- data/doc/classes/LongMath/LongDecimal.src/M000122.html +5 -33
- data/doc/classes/LongMath/LongDecimal.src/M000123.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000124.html +33 -4
- data/doc/classes/LongMath/LongDecimal.src/M000125.html +4 -33
- data/doc/classes/LongMath/LongDecimal.src/M000126.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000128.html +18 -0
- data/doc/classes/LongMath/LongDecimal.src/M000129.html +19 -0
- data/doc/classes/LongMath/LongDecimal.src/M000130.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000131.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000132.html +4 -4
- data/doc/classes/LongMath/LongDecimal.src/M000133.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.html +168 -168
- data/doc/classes/LongMath/LongDecimalQuot.src/M000026.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000027.html +14 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000028.html +4 -5
- data/doc/classes/LongMath/LongDecimalQuot.src/M000029.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000030.html +5 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000031.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000032.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000033.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000034.html +4 -8
- data/doc/classes/LongMath/LongDecimalQuot.src/M000035.html +4 -9
- data/doc/classes/LongMath/LongDecimalQuot.src/M000036.html +6 -7
- data/doc/classes/LongMath/LongDecimalQuot.src/M000037.html +5 -5
- data/doc/classes/LongMath/LongDecimalQuot.src/M000038.html +5 -5
- data/doc/classes/LongMath/LongDecimalQuot.src/M000039.html +7 -19
- data/doc/classes/LongMath/LongDecimalQuot.src/M000040.html +8 -7
- data/doc/classes/LongMath/LongDecimalQuot.src/M000041.html +21 -5
- data/doc/classes/LongMath/LongDecimalQuot.src/M000042.html +8 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000043.html +5 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000044.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000045.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000046.html +4 -63
- data/doc/classes/LongMath/LongDecimalQuot.src/M000047.html +4 -22
- data/doc/classes/LongMath/LongDecimalQuot.src/M000048.html +63 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000049.html +20 -7
- data/doc/classes/LongMath/LongDecimalQuot.src/M000050.html +4 -5
- data/doc/classes/LongMath/LongDecimalQuot.src/M000051.html +9 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000052.html +5 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000053.html +4 -4
- data/doc/classes/LongMath/LongDecimalQuot.src/M000054.html +1 -1
- data/doc/classes/LongMath/LongDecimalQuot.src/M000055.html +1 -1
- data/doc/classes/LongMath/LongDecimalQuot.src/M000056.html +18 -0
- data/doc/classes/LongMath/LongDecimalQuot.src/M000057.html +18 -0
- data/doc/classes/LongMath/LongDecimalQuot.src/M000058.html +1 -1
- data/doc/classes/LongMath/LongDecimalQuot.src/M000059.html +4 -4
- data/doc/classes/LongMath/Numeric.html +5 -5
- data/doc/classes/LongMath/Numeric.src/M000132.html +18 -0
- data/doc/classes/LongMath/Numeric.src/M000134.html +18 -0
- data/doc/created.rid +1 -1
- data/doc/files/lib/longdecimal_rb.html +2 -2
- data/doc/fr_method_index.html +115 -113
- data/lib/longdecimal.rb +84 -34
- data/test/testlongdecimal.rb +271 -15
- metadata +17 -2
data/README
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
Usage
|
2
2
|
-----
|
3
3
|
|
4
|
-
Just put longdecimal.rb in your
|
4
|
+
Just put longdecimal.rb in your site-ruby-directory and add
|
5
|
+
require "longdecimal"
|
6
|
+
to your ruby-file
|
7
|
+
or put it into the directory where you are running your ruby-programm and add
|
5
8
|
load "longdecimal.rb"
|
6
|
-
to your ruby-file.
|
9
|
+
to your ruby-file.
|
7
10
|
|
8
11
|
To test on Linux/Unix:
|
9
12
|
go into a directory long-decimal, put longdecimal.rb into a
|
@@ -18,7 +21,7 @@ and run it:
|
|
18
21
|
./test/testlongdecimal.rb
|
19
22
|
|
20
23
|
You should not get any error nor any failure. The tests will take a
|
21
|
-
|
24
|
+
few minutes or so, depending on the power of your machine.
|
22
25
|
|
23
26
|
License
|
24
27
|
-------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.00.
|
1
|
+
0.00.12
|
@@ -101,7 +101,7 @@ by LongDecimal
|
|
101
101
|
<h3 class="section-bar">Methods</h3>
|
102
102
|
|
103
103
|
<div class="name-list">
|
104
|
-
<a href="#
|
104
|
+
<a href="#M000135"><=></a>
|
105
105
|
</div>
|
106
106
|
</div>
|
107
107
|
|
@@ -130,12 +130,12 @@ by LongDecimal
|
|
130
130
|
<div id="methods">
|
131
131
|
<h3 class="section-bar">Public Instance methods</h3>
|
132
132
|
|
133
|
-
<div id="method-
|
134
|
-
<a name="
|
133
|
+
<div id="method-M000135" class="method-detail">
|
134
|
+
<a name="M000135"></a>
|
135
135
|
|
136
136
|
<div class="method-heading">
|
137
|
-
<a href="RoundingModeClass.src/
|
138
|
-
onclick="popupCode('RoundingModeClass.src/
|
137
|
+
<a href="RoundingModeClass.src/M000135.html" target="Code" class="method-signature"
|
138
|
+
onclick="popupCode('RoundingModeClass.src/M000135.html');return false;">
|
139
139
|
<span class="method-name"><=></span><span class="method-args">(o)</span>
|
140
140
|
</a>
|
141
141
|
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title><=> (LongDecimalRoundingMode::RoundingModeClass)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 32</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">o</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">respond_to?</span><span class="ruby-identifier">:num</span>
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">num</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">num</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">num</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">o</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title><=> (LongDecimalRoundingMode::RoundingModeClass)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 32</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">o</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">respond_to?</span><span class="ruby-identifier">:num</span>
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">num</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">num</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">num</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">o</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
data/doc/classes/LongMath.html
CHANGED
@@ -85,12 +85,12 @@
|
|
85
85
|
<div id="description">
|
86
86
|
<p>
|
87
87
|
<a href="LongMath.html">LongMath</a> provides some helper functions to
|
88
|
-
support <a href="LongMath.html#
|
89
|
-
href="LongMath.html#
|
88
|
+
support <a href="LongMath.html#M000024">LongDecimal</a> and <a
|
89
|
+
href="LongMath.html#M000025">LongDecimalQuot</a>, mostly operating on
|
90
90
|
integers. They are used internally here, but possibly they can be used
|
91
91
|
elsewhere as well. In addition <a href="LongMath.html">LongMath</a>
|
92
92
|
provides methods like those in Math, but for <a
|
93
|
-
href="LongMath.html#
|
93
|
+
href="LongMath.html#M000024">LongDecimal</a> instead of Float.
|
94
94
|
</p>
|
95
95
|
|
96
96
|
</div>
|
@@ -102,8 +102,9 @@ href="LongMath.html#M000022">LongDecimal</a> instead of Float.
|
|
102
102
|
<h3 class="section-bar">Methods</h3>
|
103
103
|
|
104
104
|
<div class="name-list">
|
105
|
-
<a href="#
|
106
|
-
<a href="#
|
105
|
+
<a href="#M000024">LongDecimal</a>
|
106
|
+
<a href="#M000025">LongDecimalQuot</a>
|
107
|
+
<a href="#M000016">calc_iprec_for_exp</a>
|
107
108
|
<a href="#M000014">calc_pi</a>
|
108
109
|
<a href="#M000002">check_is_int</a>
|
109
110
|
<a href="#M000003">check_is_ld</a>
|
@@ -119,7 +120,8 @@ href="LongMath.html#M000022">LongDecimal</a> instead of Float.
|
|
119
120
|
<a href="#M000021">log_internal</a>
|
120
121
|
<a href="#M000007">merge_from_words</a>
|
121
122
|
<a href="#M000013">multiplicity_of_factor</a>
|
122
|
-
<a href="#
|
123
|
+
<a href="#M000022">power</a>
|
124
|
+
<a href="#M000023">power_internal</a>
|
123
125
|
<a href="#M000006">split_to_words</a>
|
124
126
|
<a href="#M000008">sqrtb</a>
|
125
127
|
<a href="#M000009">sqrtb_with_remainder</a>
|
@@ -166,6 +168,16 @@ Class <a href="LongMath/Numeric.html" class="link">LongMath::Numeric</a><br />
|
|
166
168
|
<td>=</td>
|
167
169
|
<td class="context-item-value">Math.log(MAX_FLOATABLE).to_i</td>
|
168
170
|
</tr>
|
171
|
+
<tr class="top-aligned-row context-row">
|
172
|
+
<td class="context-item-name">LOG2</td>
|
173
|
+
<td>=</td>
|
174
|
+
<td class="context-item-value">Math.log(2.0)</td>
|
175
|
+
</tr>
|
176
|
+
<tr class="top-aligned-row context-row">
|
177
|
+
<td class="context-item-name">LOG10</td>
|
178
|
+
<td>=</td>
|
179
|
+
<td class="context-item-value">Math.log(10.0)</td>
|
180
|
+
</tr>
|
169
181
|
</table>
|
170
182
|
</div>
|
171
183
|
</div>
|
@@ -179,6 +191,23 @@ Class <a href="LongMath/Numeric.html" class="link">LongMath::Numeric</a><br />
|
|
179
191
|
<div id="methods">
|
180
192
|
<h3 class="section-bar">Public Class methods</h3>
|
181
193
|
|
194
|
+
<div id="method-M000016" class="method-detail">
|
195
|
+
<a name="M000016"></a>
|
196
|
+
|
197
|
+
<div class="method-heading">
|
198
|
+
<a href="LongMath.src/M000016.html" target="Code" class="method-signature"
|
199
|
+
onclick="popupCode('LongMath.src/M000016.html');return false;">
|
200
|
+
<span class="method-name">calc_iprec_for_exp</span><span class="method-args">(x, prec)</span>
|
201
|
+
</a>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div class="method-description">
|
205
|
+
<p>
|
206
|
+
private helper method for exponentiation calculate internal precision
|
207
|
+
</p>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
|
182
211
|
<div id="method-M000014" class="method-detail">
|
183
212
|
<a name="M000014"></a>
|
184
213
|
|
@@ -196,9 +225,9 @@ point. It works fine for 1000 or 2000 digits or so. This method could be
|
|
196
225
|
optimized more, but if you really want to go for more digits, you will find
|
197
226
|
a specialized and optimized program for this specific purpose, probably
|
198
227
|
written in C or C++. Since calculation of pi is not what should typically
|
199
|
-
be done with <a href="LongMath.html#
|
228
|
+
be done with <a href="LongMath.html#M000024">LongDecimal</a>, you may
|
200
229
|
consider this method to be the easter egg of <a
|
201
|
-
href="LongMath.html#
|
230
|
+
href="LongMath.html#M000024">LongDecimal</a>. ;-)
|
202
231
|
</p>
|
203
232
|
</div>
|
204
233
|
</div>
|
@@ -233,7 +262,7 @@ helper method for internal use: checks if parameter x is an Integer
|
|
233
262
|
<div class="method-description">
|
234
263
|
<p>
|
235
264
|
helper method for internal use: checks if parameter x is a <a
|
236
|
-
href="LongMath.html#
|
265
|
+
href="LongMath.html#M000024">LongDecimal</a>
|
237
266
|
</p>
|
238
267
|
</div>
|
239
268
|
</div>
|
@@ -270,7 +299,7 @@ helper method for internal use: checks if parameter x is a rounding mode
|
|
270
299
|
<p>
|
271
300
|
helper method for internal use: checks if parameter x is a reasonable value
|
272
301
|
for the precision (scale) of a <a
|
273
|
-
href="LongMath.html#
|
302
|
+
href="LongMath.html#M000024">LongDecimal</a>
|
274
303
|
</p>
|
275
304
|
</div>
|
276
305
|
</div>
|
@@ -306,7 +335,7 @@ splitting a number into parts
|
|
306
335
|
<div class="method-description">
|
307
336
|
<p>
|
308
337
|
calc the exponential function of x to the given precision as <a
|
309
|
-
href="LongMath.html#
|
338
|
+
href="LongMath.html#M000024">LongDecimal</a>. Only supports values of x
|
310
339
|
such that the result still fits into a float (x <= 709). This limitation
|
311
340
|
is somewhat arbitrary, but it is enforced in order to avoid producing
|
312
341
|
numbers with the exponential function that exceed the memory. It may be
|
@@ -366,7 +395,7 @@ exponent such that gcd(x, b**m) = gcd(x, b**n) for all m, n >= n0
|
|
366
395
|
<div class="method-description">
|
367
396
|
<p>
|
368
397
|
calculate the natural logarithm function of x to the given precision as <a
|
369
|
-
href="LongMath.html#
|
398
|
+
href="LongMath.html#M000024">LongDecimal</a>.
|
370
399
|
</p>
|
371
400
|
</div>
|
372
401
|
</div>
|
@@ -384,7 +413,7 @@ href="LongMath.html#M000022">LongDecimal</a>.
|
|
384
413
|
<div class="method-description">
|
385
414
|
<p>
|
386
415
|
calculate the base 10 logarithm of x to the given precision as <a
|
387
|
-
href="LongMath.html#
|
416
|
+
href="LongMath.html#M000024">LongDecimal</a>.
|
388
417
|
</p>
|
389
418
|
</div>
|
390
419
|
</div>
|
@@ -402,7 +431,7 @@ href="LongMath.html#M000022">LongDecimal</a>.
|
|
402
431
|
<div class="method-description">
|
403
432
|
<p>
|
404
433
|
calculate the base 2 logarithm of x to the given precision as <a
|
405
|
-
href="LongMath.html#
|
434
|
+
href="LongMath.html#M000024">LongDecimal</a>.
|
406
435
|
</p>
|
407
436
|
</div>
|
408
437
|
</div>
|
@@ -467,12 +496,12 @@ that exceed the range of Float
|
|
467
496
|
</div>
|
468
497
|
</div>
|
469
498
|
|
470
|
-
<div id="method-
|
471
|
-
<a name="
|
499
|
+
<div id="method-M000022" class="method-detail">
|
500
|
+
<a name="M000022"></a>
|
472
501
|
|
473
502
|
<div class="method-heading">
|
474
|
-
<a href="LongMath.src/
|
475
|
-
onclick="popupCode('LongMath.src/
|
503
|
+
<a href="LongMath.src/M000022.html" target="Code" class="method-signature"
|
504
|
+
onclick="popupCode('LongMath.src/M000022.html');return false;">
|
476
505
|
<span class="method-name">power</span><span class="method-args">(x, y, prec, mode = LongDecimal::ROUND_HALF_DOWN)</span>
|
477
506
|
</a>
|
478
507
|
</div>
|
@@ -480,12 +509,32 @@ that exceed the range of Float
|
|
480
509
|
<div class="method-description">
|
481
510
|
<p>
|
482
511
|
calc the power of x with exponent y to the given precision as <a
|
483
|
-
href="LongMath.html#
|
512
|
+
href="LongMath.html#M000024">LongDecimal</a>. Only supports values of y
|
484
513
|
such that exp(y) still fits into a float (y <= 709)
|
485
514
|
</p>
|
486
515
|
</div>
|
487
516
|
</div>
|
488
517
|
|
518
|
+
<div id="method-M000023" class="method-detail">
|
519
|
+
<a name="M000023"></a>
|
520
|
+
|
521
|
+
<div class="method-heading">
|
522
|
+
<a href="LongMath.src/M000023.html" target="Code" class="method-signature"
|
523
|
+
onclick="popupCode('LongMath.src/M000023.html');return false;">
|
524
|
+
<span class="method-name">power_internal</span><span class="method-args">(x, y, prec = nil, final_mode = LongDecimal::ROUND_HALF_DOWN, iprec = nil, mode = LongDecimal::ROUND_HALF_DOWN)</span>
|
525
|
+
</a>
|
526
|
+
</div>
|
527
|
+
|
528
|
+
<div class="method-description">
|
529
|
+
<p>
|
530
|
+
internal functionality of exp. exposes some more parameters, that should
|
531
|
+
usually be set to defaut values, in order to allow better testing. do not
|
532
|
+
actually call this method unless you are testing exp. create a bug report,
|
533
|
+
if the default settings for the parameters do not work correctly
|
534
|
+
</p>
|
535
|
+
</div>
|
536
|
+
</div>
|
537
|
+
|
489
538
|
<div id="method-M000006" class="method-detail">
|
490
539
|
<a name="M000006"></a>
|
491
540
|
|
@@ -594,38 +643,38 @@ integer y such that y**2
|
|
594
643
|
|
595
644
|
<h3 class="section-bar">Public Instance methods</h3>
|
596
645
|
|
597
|
-
<div id="method-
|
598
|
-
<a name="
|
646
|
+
<div id="method-M000024" class="method-detail">
|
647
|
+
<a name="M000024"></a>
|
599
648
|
|
600
649
|
<div class="method-heading">
|
601
|
-
<a href="LongMath.src/
|
602
|
-
onclick="popupCode('LongMath.src/
|
650
|
+
<a href="LongMath.src/M000024.html" target="Code" class="method-signature"
|
651
|
+
onclick="popupCode('LongMath.src/M000024.html');return false;">
|
603
652
|
<span class="method-name">LongDecimal</span><span class="method-args">(a, b = 0)</span>
|
604
653
|
</a>
|
605
654
|
</div>
|
606
655
|
|
607
656
|
<div class="method-description">
|
608
657
|
<p>
|
609
|
-
Creates a <a href="LongMath.html#
|
658
|
+
Creates a <a href="LongMath.html#M000024">LongDecimal</a> number.
|
610
659
|
<tt>a</tt> and <tt>b</tt> should be <a
|
611
660
|
href="LongMath/Numeric.html">Numeric</a>.
|
612
661
|
</p>
|
613
662
|
</div>
|
614
663
|
</div>
|
615
664
|
|
616
|
-
<div id="method-
|
617
|
-
<a name="
|
665
|
+
<div id="method-M000025" class="method-detail">
|
666
|
+
<a name="M000025"></a>
|
618
667
|
|
619
668
|
<div class="method-heading">
|
620
|
-
<a href="LongMath.src/
|
621
|
-
onclick="popupCode('LongMath.src/
|
669
|
+
<a href="LongMath.src/M000025.html" target="Code" class="method-signature"
|
670
|
+
onclick="popupCode('LongMath.src/M000025.html');return false;">
|
622
671
|
<span class="method-name">LongDecimalQuot</span><span class="method-args">(first, second)</span>
|
623
672
|
</a>
|
624
673
|
</div>
|
625
674
|
|
626
675
|
<div class="method-description">
|
627
676
|
<p>
|
628
|
-
construct a <a href="LongMath.html#
|
677
|
+
construct a <a href="LongMath.html#M000025">LongDecimalQuot</a> from the
|
629
678
|
given parameters 1st case: both are LongDecimals 2nd case: first is
|
630
679
|
Rational, second is scale
|
631
680
|
</p>
|
@@ -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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 75</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_word_len</span>(<span class="ruby-identifier">word_len</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"word_len"</span>)
|
15
15
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name} must be a positive number <= 1024"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">word_len</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Fixnum</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">word_len</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">word_len</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1024</span>
|
16
16
|
<span class="ruby-identifier">word_len</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 83</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"x"</span>)
|
15
15
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name}=#{x.inspect} must be Integer"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 90</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_ld</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"x"</span>)
|
15
15
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"x=#{x.inspect} must be LongDecimal"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimal</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 98</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_prec</span>(<span class="ruby-identifier">prec</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"prec"</span>)
|
15
15
|
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">prec</span>, <span class="ruby-value str">"prec"</span>)
|
16
16
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name}=#{prec.inspect} must be >= 0"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">prec</span> <span class="ruby-operator">>=</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 107</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_mode</span>(<span class="ruby-identifier">mode</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"mode"</span>)
|
15
15
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name}=#{mode.inspect} must be legal rounding mode"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">RoundingModeClass</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 116</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">split_to_words</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">word_len</span> = <span class="ruby-value">32</span>)
|
15
15
|
<span class="ruby-identifier">check_word_len</span>(<span class="ruby-identifier">word_len</span>)
|
16
16
|
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>, <span class="ruby-value str">"x"</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 138</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">merge_from_words</span>(<span class="ruby-identifier">words</span>, <span class="ruby-identifier">word_len</span> = <span class="ruby-value">32</span>)
|
15
15
|
<span class="ruby-identifier">check_word_len</span>(<span class="ruby-identifier">word_len</span>)
|
16
16
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">"words must be array of length > 0"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">words</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">words</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 162</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtb</span>(<span class="ruby-identifier">x</span>)
|
15
15
|
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">sqrtb_with_remainder</span>(<span class="ruby-identifier">x</span>)
|
16
16
|
<span class="ruby-identifier">a</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 173</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtb_with_remainder</span>(<span class="ruby-identifier">x</span>)
|
15
15
|
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>, <span class="ruby-value str">"x"</span>)
|
16
16
|
|
@@ -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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 212</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtw</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">n</span> = <span class="ruby-value">16</span>)
|
15
15
|
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">sqrtw_with_remainder</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">n</span>)
|
16
16
|
<span class="ruby-identifier">a</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/longdecimal.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 225</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtw_with_remainder</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">n</span> = <span class="ruby-value">16</span>)
|
15
15
|
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>, <span class="ruby-value str">"x"</span>)
|
16
16
|
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">n</span>, <span class="ruby-value str">"n"</span>)
|
@@ -60,7 +60,7 @@
|
|
60
60
|
<span class="ruby-keyword kw">end</span>
|
61
61
|
<span class="ruby-identifier">j</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
62
62
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">j</span> <span class="ruby-operator">></span> <span class="ruby-value">10</span>) <span class="ruby-keyword kw">then</span>
|
63
|
-
<span class="ruby-
|
63
|
+
<span class="ruby-comment cmt"># puts("i=#{i} j=#{j} q=#{q} q0=#{q0} d0=#{d0} d=#{d} r=#{r} yi=#{yi} xi=#{xi}\n")</span>
|
64
64
|
<span class="ruby-keyword kw">break</span>
|
65
65
|
<span class="ruby-keyword kw">end</span>
|
66
66
|
<span class="ruby-keyword kw">end</span>
|