long-decimal 0.00.19 → 0.00.20
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.
- data/README +25 -22
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/doc/classes/LongDecimal.html +327 -286
- data/doc/classes/LongDecimal.src/M000041.html +10 -4
- data/doc/classes/LongDecimal.src/M000042.html +3 -2
- data/doc/classes/LongDecimal.src/M000043.html +10 -26
- data/doc/classes/LongDecimal.src/M000044.html +24 -16
- data/doc/classes/LongDecimal.src/M000045.html +19 -4
- data/doc/classes/LongDecimal.src/M000046.html +4 -15
- data/doc/classes/LongDecimal.src/M000047.html +13 -26
- data/doc/classes/LongDecimal.src/M000048.html +28 -4
- data/doc/classes/LongDecimal.src/M000049.html +4 -8
- data/doc/classes/LongDecimal.src/M000050.html +8 -6
- data/doc/classes/LongDecimal.src/M000051.html +6 -4
- data/doc/classes/LongDecimal.src/M000052.html +4 -15
- data/doc/classes/LongDecimal.src/M000053.html +8 -24
- data/doc/classes/LongDecimal.src/M000054.html +6 -14
- data/doc/classes/LongDecimal.src/M000055.html +4 -13
- data/doc/classes/LongDecimal.src/M000056.html +15 -4
- data/doc/classes/LongDecimal.src/M000057.html +27 -0
- data/doc/classes/LongDecimal.src/M000058.html +4 -4
- data/doc/classes/LongDecimal.src/M000060.html +4 -4
- data/doc/classes/LongDecimal.src/M000061.html +5 -4
- data/doc/classes/LongDecimal.src/M000062.html +5 -8
- data/doc/classes/LongDecimal.src/M000063.html +4 -9
- data/doc/classes/LongDecimal.src/M000064.html +6 -7
- data/doc/classes/LongDecimal.src/M000065.html +6 -6
- data/doc/classes/LongDecimal.src/M000066.html +9 -4
- data/doc/classes/LongDecimal.src/M000067.html +7 -13
- data/doc/classes/LongDecimal.src/M000068.html +4 -9
- data/doc/classes/LongDecimal.src/M000069.html +13 -7
- data/doc/classes/LongDecimal.src/M000070.html +7 -18
- data/doc/classes/LongDecimal.src/M000071.html +8 -7
- data/doc/classes/LongDecimal.src/M000072.html +20 -5
- data/doc/classes/LongDecimal.src/M000073.html +6 -7
- data/doc/classes/LongDecimal.src/M000074.html +5 -9
- data/doc/classes/LongDecimal.src/M000075.html +5 -5
- data/doc/classes/LongDecimal.src/M000076.html +9 -4
- data/doc/classes/LongDecimal.src/M000077.html +7 -5
- data/doc/classes/LongDecimal.src/M000078.html +4 -7
- data/doc/classes/LongDecimal.src/M000079.html +7 -4
- data/doc/classes/LongDecimal.src/M000080.html +7 -4
- data/doc/classes/LongDecimal.src/M000081.html +4 -9
- data/doc/classes/LongDecimal.src/M000082.html +3 -8
- data/doc/classes/LongDecimal.src/M000083.html +9 -5
- data/doc/classes/LongDecimal.src/M000084.html +7 -7
- data/doc/classes/LongDecimal.src/M000085.html +5 -4
- data/doc/classes/LongDecimal.src/M000086.html +9 -4
- data/doc/classes/LongDecimal.src/M000087.html +4 -4
- data/doc/classes/LongDecimal.src/M000088.html +4 -4
- data/doc/classes/LongDecimal.src/M000089.html +4 -59
- data/doc/classes/LongDecimal.src/M000090.html +4 -4
- data/doc/classes/LongDecimal.src/M000091.html +59 -4
- data/doc/classes/LongDecimal.src/M000092.html +18 -0
- data/doc/classes/LongDecimal.src/M000093.html +18 -0
- data/doc/classes/LongDecimal.src/M000096.html +5 -4
- data/doc/classes/LongDecimal.src/M000097.html +5 -4
- data/doc/classes/LongDecimal.src/M000098.html +4 -4
- data/doc/classes/LongDecimal.src/M000099.html +4 -4
- data/doc/classes/LongDecimal.src/M000100.html +18 -0
- data/doc/classes/LongDecimal.src/M000101.html +18 -0
- data/doc/classes/LongDecimalBase.html +53 -53
- data/doc/classes/LongDecimalBase.src/M000104.html +4 -4
- data/doc/classes/LongDecimalBase.src/M000105.html +4 -4
- data/doc/classes/LongDecimalBase.src/M000106.html +4 -4
- data/doc/classes/LongDecimalBase.src/M000107.html +4 -4
- data/doc/classes/LongDecimalBase.src/M000108.html +18 -0
- data/doc/classes/LongDecimalBase.src/M000109.html +4 -9
- data/doc/classes/LongDecimalBase.src/M000112.html +9 -4
- data/doc/classes/LongDecimalBase.src/M000113.html +19 -0
- data/doc/classes/LongDecimalBase.src/M000114.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000003.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000004.html +22 -5
- data/doc/classes/LongDecimalQuot.src/M000005.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000006.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000007.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000008.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000009.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000010.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000011.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000012.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000013.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000014.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000015.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000016.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000017.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000018.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000019.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000020.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000021.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000022.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000023.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000024.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000025.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000026.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000027.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000028.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000029.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000032.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000033.html +1 -1
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.html +10 -10
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000141.html +22 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000142.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000146.html +22 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000147.html +18 -0
- data/doc/classes/LongMath.html +191 -137
- data/doc/classes/LongMath.src/M000115.html +5 -4
- data/doc/classes/LongMath.src/M000116.html +4 -5
- data/doc/classes/LongMath.src/M000117.html +4 -4
- data/doc/classes/LongMath.src/M000118.html +5 -18
- data/doc/classes/LongMath.src/M000119.html +4 -18
- data/doc/classes/LongMath.src/M000120.html +18 -5
- data/doc/classes/LongMath.src/M000121.html +16 -27
- data/doc/classes/LongMath.src/M000122.html +4 -4
- data/doc/classes/LongMath.src/M000123.html +17 -44
- data/doc/classes/LongMath.src/M000124.html +5 -21
- data/doc/classes/LongMath.src/M000125.html +49 -29
- data/doc/classes/LongMath.src/M000126.html +20 -47
- data/doc/classes/LongMath.src/M000127.html +36 -8
- data/doc/classes/LongMath.src/M000128.html +6 -4
- data/doc/classes/LongMath.src/M000129.html +33 -4
- data/doc/classes/LongMath.src/M000130.html +40 -56
- data/doc/classes/LongMath.src/M000131.html +8 -43
- data/doc/classes/LongMath.src/M000132.html +4 -10
- data/doc/classes/LongMath.src/M000133.html +4 -7
- data/doc/classes/LongMath.src/M000134.html +58 -15
- data/doc/classes/LongMath.src/M000135.html +39 -16
- data/doc/classes/LongMath.src/M000136.html +6 -39
- data/doc/classes/LongMath.src/M000137.html +5 -168
- data/doc/classes/LongMath.src/M000138.html +34 -0
- data/doc/classes/LongMath.src/M000139.html +34 -0
- data/doc/classes/LongMath.src/M000140.html +57 -0
- data/doc/classes/LongMath.src/M000141.html +219 -0
- data/doc/classes/LongMath.src/M000142.html +33 -0
- data/doc/classes/LongMath.src/M000143.html +70 -0
- data/doc/classes/LongMath.src/M000144.html +58 -0
- data/doc/classes/LongMath/CacheKey.html +164 -0
- data/doc/classes/LongMath/CacheKey.src/M000140.html +36 -0
- data/doc/classes/LongMath/CacheKey.src/M000145.html +36 -0
- data/doc/classes/Numeric.html +5 -5
- data/doc/classes/Numeric.src/M000102.html +23 -0
- data/doc/classes/Rational.html +5 -5
- data/doc/classes/Rational.src/M000103.html +23 -0
- data/doc/created.rid +1 -1
- data/doc/files/lib/long-decimal_rb.html +2 -2
- data/doc/files/lib/long-decimal_rb.src/M000001.html +1 -1
- data/doc/files/lib/long-decimal_rb.src/M000002.html +1 -1
- data/doc/fr_method_index.html +106 -101
- data/lib/long-decimal.rb +203 -85
- data/test/testlongdecimal.rb +372 -69
- metadata +28 -2
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>abs (LongDecimal)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1084</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abs</span>
|
15
|
+
<span class="ruby-constant">LongDecimal</span>(<span class="ruby-identifier">int_val</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">scale</span>)
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -5,14 +5,69 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>coerce (LongDecimal)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1093</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimal</span> <span class="ruby-keyword kw">then</span>
|
17
|
+
<span class="ruby-comment cmt"># if other is LongDecimal as well, nothing to do</span>
|
18
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">other</span>, <span class="ruby-keyword kw">self</span>
|
19
|
+
|
20
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalQuot</span> <span class="ruby-keyword kw">then</span>
|
21
|
+
<span class="ruby-comment cmt"># if other is LongDecimalQuot, convert self to LongDecimalQuot</span>
|
22
|
+
<span class="ruby-comment cmt"># as well</span>
|
23
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">other</span>, <span class="ruby-constant">LongDecimalQuot</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_r</span>, <span class="ruby-identifier">scale</span>)
|
24
|
+
|
25
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Rational</span> <span class="ruby-keyword kw">then</span>
|
26
|
+
<span class="ruby-comment cmt"># if other is Rational, convert self and other to</span>
|
27
|
+
<span class="ruby-comment cmt"># LongDecimalQuot. This is well adapted to cover both.</span>
|
28
|
+
<span class="ruby-identifier">sc</span> = <span class="ruby-identifier">scale</span>
|
29
|
+
<span class="ruby-identifier">o</span> = <span class="ruby-constant">LongDecimalQuot</span>(<span class="ruby-identifier">other</span>, <span class="ruby-identifier">sc</span>)
|
30
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-constant">LongDecimalQuot</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_r</span>, <span class="ruby-identifier">sc</span>)
|
31
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span>
|
32
|
+
|
33
|
+
<span class="ruby-comment cmt"># we could use BigDecimal as common type for combining Float and</span>
|
34
|
+
<span class="ruby-comment cmt"># LongDecimal, but this needs a lot of consideration. For the</span>
|
35
|
+
<span class="ruby-comment cmt"># time being we assume that we live well enough with converting</span>
|
36
|
+
<span class="ruby-comment cmt"># Float into LongDecimal</span>
|
37
|
+
<span class="ruby-comment cmt"># elsif (other.kind_of? Float) && size > 8 then</span>
|
38
|
+
<span class="ruby-comment cmt"># return coerce(BigDecimal(other.to_s))</span>
|
39
|
+
|
40
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Float</span>) <span class="ruby-keyword kw">then</span>
|
41
|
+
<span class="ruby-comment cmt"># if other is Integer or Float, convert it to LongDecimal</span>
|
42
|
+
<span class="ruby-identifier">other</span> = <span class="ruby-constant">LongDecimal</span>(<span class="ruby-identifier">other</span>)
|
43
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">other</span>.<span class="ruby-identifier">scale</span> <span class="ruby-operator">></span> <span class="ruby-identifier">scale</span>) <span class="ruby-keyword kw">then</span>
|
44
|
+
<span class="ruby-identifier">other</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">round_to_scale</span>(<span class="ruby-identifier">scale</span>, <span class="ruby-constant">ROUND_HALF_UP</span>)
|
45
|
+
<span class="ruby-keyword kw">end</span>
|
46
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">other</span>, <span class="ruby-keyword kw">self</span>
|
47
|
+
|
48
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">BigDecimal</span> <span class="ruby-keyword kw">then</span>
|
49
|
+
<span class="ruby-comment cmt"># if other is BigDecimal convert self to BigDecimal</span>
|
50
|
+
<span class="ruby-identifier">s</span>, <span class="ruby-identifier">o</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">coerce</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_bd</span>)
|
51
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span>
|
52
|
+
|
53
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Complex</span> <span class="ruby-keyword kw">then</span>
|
54
|
+
<span class="ruby-comment cmt"># if other is Complex, convert self to Float and then to</span>
|
55
|
+
<span class="ruby-comment cmt"># Complex. It need to be observed that this will fail if self</span>
|
56
|
+
<span class="ruby-comment cmt"># has too many digits before the decimal point to be expressed</span>
|
57
|
+
<span class="ruby-comment cmt"># as Float.</span>
|
58
|
+
<span class="ruby-identifier">s</span>, <span class="ruby-identifier">o</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">coerce</span>(<span class="ruby-constant">Complex</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_f</span>, <span class="ruby-value">0</span>))
|
59
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span>
|
60
|
+
|
61
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Numeric</span> <span class="ruby-keyword kw">then</span>
|
62
|
+
<span class="ruby-comment cmt"># all other go by expressing self as Float and seeing how it</span>
|
63
|
+
<span class="ruby-comment cmt"># combines with other.</span>
|
64
|
+
<span class="ruby-identifier">s</span>, <span class="ruby-identifier">o</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">coerce</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_f</span>)
|
65
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span>
|
66
|
+
|
67
|
+
<span class="ruby-keyword kw">else</span>
|
68
|
+
<span class="ruby-comment cmt"># non-numeric types do not work here</span>
|
69
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"unsupported type #{other.inspect} for coerce of LongDecimal"</span>
|
70
|
+
<span class="ruby-keyword kw">end</span>
|
16
71
|
<span class="ruby-keyword kw">end</span></pre>
|
17
72
|
</body>
|
18
73
|
</html>
|
@@ -0,0 +1,18 @@
|
|
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>is_int? (LongDecimal)</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/long-decimal.rb, line 1155</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_int?</span>
|
15
|
+
<span class="ruby-identifier">scale</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">int_val</span> <span class="ruby-operator">%</span> <span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-identifier">scale</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>sgn (LongDecimal)</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/long-decimal.rb, line 1165</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sgn</span>
|
15
|
+
<span class="ruby-identifier">int_val</span> <span class="ruby-operator"><=></span> <span class="ruby-value">0</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -5,14 +5,15 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title
|
8
|
+
<title>== (LongDecimal)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1177</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
<span class="ruby-comment cmt"># (other.kind_of? LongDecimal) && (self <=> other) == 0 && self.scale == other.scale</span>
|
16
|
+
(<span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimal</span>) <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">int_val</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">int_val</span> <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scale</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">scale</span>
|
16
17
|
<span class="ruby-keyword kw">end</span></pre>
|
17
18
|
</body>
|
18
19
|
</html>
|
@@ -5,14 +5,15 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title
|
8
|
+
<title>=== (LongDecimal)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1187</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
<span class="ruby-comment cmt"># (other.kind_of? LongDecimal) && self.int_val == other.int_val</span>
|
16
|
+
(<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>).<span class="ruby-identifier">zero?</span>
|
16
17
|
<span class="ruby-keyword kw">end</span></pre>
|
17
18
|
</body>
|
18
19
|
</html>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>zero? (LongDecimal)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">int_val</span>.<span class="ruby-identifier">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1196</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zero?</span>
|
15
|
+
<span class="ruby-identifier">int_val</span>.<span class="ruby-identifier">zero?</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>one? (LongDecimal)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1204</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">one?</span>
|
15
|
+
(<span class="ruby-keyword kw">self</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">zero?</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -0,0 +1,18 @@
|
|
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>hash (LongDecimal)</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/long-decimal.rb, line 1211</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hash</span>
|
15
|
+
<span class="ruby-identifier">int_val</span>.<span class="ruby-identifier">hash</span> <span class="ruby-operator">^</span> <span class="ruby-identifier">scale</span>.<span class="ruby-identifier">hash</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>inspect (LongDecimal)</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/long-decimal.rb, line 1218</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
15
|
+
<span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"LongDecimal(%s, %s)"</span>, <span class="ruby-identifier">int_val</span>.<span class="ruby-identifier">inspect</span>, <span class="ruby-identifier">scale</span>.<span class="ruby-identifier">inspect</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -110,17 +110,17 @@ href="LongDecimalQuot.html">LongDecimalQuot</a>
|
|
110
110
|
<h3 class="section-bar">Methods</h3>
|
111
111
|
|
112
112
|
<div class="name-list">
|
113
|
-
<a href="#
|
114
|
-
<a href="#
|
115
|
-
<a href="#
|
116
|
-
<a href="#
|
117
|
-
<a href="#
|
118
|
-
<a href="#
|
119
|
-
<a href="#
|
120
|
-
<a href="#
|
121
|
-
<a href="#
|
122
|
-
<a href="#
|
123
|
-
<a href="#
|
113
|
+
<a href="#M000107">+@</a>
|
114
|
+
<a href="#M000112"><=></a>
|
115
|
+
<a href="#M000111">abs2</a>
|
116
|
+
<a href="#M000106">dec</a>
|
117
|
+
<a href="#M000105">inc</a>
|
118
|
+
<a href="#M000110">inverse</a>
|
119
|
+
<a href="#M000109">reciprocal</a>
|
120
|
+
<a href="#M000114">scale_equal</a>
|
121
|
+
<a href="#M000113">scale_ufo</a>
|
122
|
+
<a href="#M000108">square</a>
|
123
|
+
<a href="#M000104">to_r</a>
|
124
124
|
</div>
|
125
125
|
</div>
|
126
126
|
|
@@ -149,12 +149,12 @@ href="LongDecimalQuot.html">LongDecimalQuot</a>
|
|
149
149
|
<div id="methods">
|
150
150
|
<h3 class="section-bar">Public Instance methods</h3>
|
151
151
|
|
152
|
-
<div id="method-
|
153
|
-
<a name="
|
152
|
+
<div id="method-M000107" class="method-detail">
|
153
|
+
<a name="M000107"></a>
|
154
154
|
|
155
155
|
<div class="method-heading">
|
156
|
-
<a href="LongDecimalBase.src/
|
157
|
-
onclick="popupCode('LongDecimalBase.src/
|
156
|
+
<a href="LongDecimalBase.src/M000107.html" target="Code" class="method-signature"
|
157
|
+
onclick="popupCode('LongDecimalBase.src/M000107.html');return false;">
|
158
158
|
<span class="method-name">+@</span><span class="method-args">()</span>
|
159
159
|
</a>
|
160
160
|
</div>
|
@@ -166,12 +166,12 @@ unary plus returns self
|
|
166
166
|
</div>
|
167
167
|
</div>
|
168
168
|
|
169
|
-
<div id="method-
|
170
|
-
<a name="
|
169
|
+
<div id="method-M000112" class="method-detail">
|
170
|
+
<a name="M000112"></a>
|
171
171
|
|
172
172
|
<div class="method-heading">
|
173
|
-
<a href="LongDecimalBase.src/
|
174
|
-
onclick="popupCode('LongDecimalBase.src/
|
173
|
+
<a href="LongDecimalBase.src/M000112.html" target="Code" class="method-signature"
|
174
|
+
onclick="popupCode('LongDecimalBase.src/M000112.html');return false;">
|
175
175
|
<span class="method-name"><=></span><span class="method-args">(other)</span>
|
176
176
|
</a>
|
177
177
|
</div>
|
@@ -193,8 +193,8 @@ of potentially zero digits after the decimal point.
|
|
193
193
|
</div>
|
194
194
|
</div>
|
195
195
|
|
196
|
-
<div id="method-
|
197
|
-
<a name="
|
196
|
+
<div id="method-M000111" class="method-detail">
|
197
|
+
<a name="M000111"></a>
|
198
198
|
|
199
199
|
<div class="method-heading">
|
200
200
|
<span class="method-name">abs2</span><span class="method-args">()</span>
|
@@ -202,17 +202,17 @@ of potentially zero digits after the decimal point.
|
|
202
202
|
|
203
203
|
<div class="method-description">
|
204
204
|
<p>
|
205
|
-
Alias for <a href="LongDecimalBase.html#
|
205
|
+
Alias for <a href="LongDecimalBase.html#M000108">square</a>
|
206
206
|
</p>
|
207
207
|
</div>
|
208
208
|
</div>
|
209
209
|
|
210
|
-
<div id="method-
|
211
|
-
<a name="
|
210
|
+
<div id="method-M000106" class="method-detail">
|
211
|
+
<a name="M000106"></a>
|
212
212
|
|
213
213
|
<div class="method-heading">
|
214
|
-
<a href="LongDecimalBase.src/
|
215
|
-
onclick="popupCode('LongDecimalBase.src/
|
214
|
+
<a href="LongDecimalBase.src/M000106.html" target="Code" class="method-signature"
|
215
|
+
onclick="popupCode('LongDecimalBase.src/M000106.html');return false;">
|
216
216
|
<span class="method-name">dec</span><span class="method-args">()</span>
|
217
217
|
</a>
|
218
218
|
</div>
|
@@ -224,12 +224,12 @@ self - 1
|
|
224
224
|
</div>
|
225
225
|
</div>
|
226
226
|
|
227
|
-
<div id="method-
|
228
|
-
<a name="
|
227
|
+
<div id="method-M000105" class="method-detail">
|
228
|
+
<a name="M000105"></a>
|
229
229
|
|
230
230
|
<div class="method-heading">
|
231
|
-
<a href="LongDecimalBase.src/
|
232
|
-
onclick="popupCode('LongDecimalBase.src/
|
231
|
+
<a href="LongDecimalBase.src/M000105.html" target="Code" class="method-signature"
|
232
|
+
onclick="popupCode('LongDecimalBase.src/M000105.html');return false;">
|
233
233
|
<span class="method-name">inc</span><span class="method-args">()</span>
|
234
234
|
</a>
|
235
235
|
</div>
|
@@ -241,8 +241,8 @@ self + 1
|
|
241
241
|
</div>
|
242
242
|
</div>
|
243
243
|
|
244
|
-
<div id="method-
|
245
|
-
<a name="
|
244
|
+
<div id="method-M000110" class="method-detail">
|
245
|
+
<a name="M000110"></a>
|
246
246
|
|
247
247
|
<div class="method-heading">
|
248
248
|
<span class="method-name">inverse</span><span class="method-args">()</span>
|
@@ -250,17 +250,17 @@ self + 1
|
|
250
250
|
|
251
251
|
<div class="method-description">
|
252
252
|
<p>
|
253
|
-
Alias for <a href="LongDecimalBase.html#
|
253
|
+
Alias for <a href="LongDecimalBase.html#M000109">reciprocal</a>
|
254
254
|
</p>
|
255
255
|
</div>
|
256
256
|
</div>
|
257
257
|
|
258
|
-
<div id="method-
|
259
|
-
<a name="
|
258
|
+
<div id="method-M000109" class="method-detail">
|
259
|
+
<a name="M000109"></a>
|
260
260
|
|
261
261
|
<div class="method-heading">
|
262
|
-
<a href="LongDecimalBase.src/
|
263
|
-
onclick="popupCode('LongDecimalBase.src/
|
262
|
+
<a href="LongDecimalBase.src/M000109.html" target="Code" class="method-signature"
|
263
|
+
onclick="popupCode('LongDecimalBase.src/M000109.html');return false;">
|
264
264
|
<span class="method-name">reciprocal</span><span class="method-args">()</span>
|
265
265
|
</a>
|
266
266
|
</div>
|
@@ -272,12 +272,12 @@ calculate the multiplicative inverse
|
|
272
272
|
</div>
|
273
273
|
</div>
|
274
274
|
|
275
|
-
<div id="method-
|
276
|
-
<a name="
|
275
|
+
<div id="method-M000114" class="method-detail">
|
276
|
+
<a name="M000114"></a>
|
277
277
|
|
278
278
|
<div class="method-heading">
|
279
|
-
<a href="LongDecimalBase.src/
|
280
|
-
onclick="popupCode('LongDecimalBase.src/
|
279
|
+
<a href="LongDecimalBase.src/M000114.html" target="Code" class="method-signature"
|
280
|
+
onclick="popupCode('LongDecimalBase.src/M000114.html');return false;">
|
281
281
|
<span class="method-name">scale_equal</span><span class="method-args">(other)</span>
|
282
282
|
</a>
|
283
283
|
</div>
|
@@ -287,12 +287,12 @@ calculate the multiplicative inverse
|
|
287
287
|
</div>
|
288
288
|
</div>
|
289
289
|
|
290
|
-
<div id="method-
|
291
|
-
<a name="
|
290
|
+
<div id="method-M000113" class="method-detail">
|
291
|
+
<a name="M000113"></a>
|
292
292
|
|
293
293
|
<div class="method-heading">
|
294
|
-
<a href="LongDecimalBase.src/
|
295
|
-
onclick="popupCode('LongDecimalBase.src/
|
294
|
+
<a href="LongDecimalBase.src/M000113.html" target="Code" class="method-signature"
|
295
|
+
onclick="popupCode('LongDecimalBase.src/M000113.html');return false;">
|
296
296
|
<span class="method-name">scale_ufo</span><span class="method-args">(other)</span>
|
297
297
|
</a>
|
298
298
|
</div>
|
@@ -304,12 +304,12 @@ calculate the multiplicative inverse
|
|
304
304
|
</div>
|
305
305
|
</div>
|
306
306
|
|
307
|
-
<div id="method-
|
308
|
-
<a name="
|
307
|
+
<div id="method-M000108" class="method-detail">
|
308
|
+
<a name="M000108"></a>
|
309
309
|
|
310
310
|
<div class="method-heading">
|
311
|
-
<a href="LongDecimalBase.src/
|
312
|
-
onclick="popupCode('LongDecimalBase.src/
|
311
|
+
<a href="LongDecimalBase.src/M000108.html" target="Code" class="method-signature"
|
312
|
+
onclick="popupCode('LongDecimalBase.src/M000108.html');return false;">
|
313
313
|
<span class="method-name">square</span><span class="method-args">()</span>
|
314
314
|
</a>
|
315
315
|
</div>
|
@@ -321,12 +321,12 @@ calculate the square of self
|
|
321
321
|
</div>
|
322
322
|
</div>
|
323
323
|
|
324
|
-
<div id="method-
|
325
|
-
<a name="
|
324
|
+
<div id="method-M000104" class="method-detail">
|
325
|
+
<a name="M000104"></a>
|
326
326
|
|
327
327
|
<div class="method-heading">
|
328
|
-
<a href="LongDecimalBase.src/
|
329
|
-
onclick="popupCode('LongDecimalBase.src/
|
328
|
+
<a href="LongDecimalBase.src/M000104.html" target="Code" class="method-signature"
|
329
|
+
onclick="popupCode('LongDecimalBase.src/M000104.html');return false;">
|
330
330
|
<span class="method-name">to_r</span><span class="method-args">()</span>
|
331
331
|
</a>
|
332
332
|
</div>
|