long-decimal 0.01.01 → 0.01.02
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 +17 -94
- data/VERSION +1 -1
- data/doc/classes/Integer.html +239 -0
- data/doc/classes/Integer.src/M000036.html +18 -0
- data/doc/classes/Integer.src/M000039.html +145 -0
- data/doc/classes/LongDecimal.html +453 -399
- data/doc/classes/LongDecimal.src/M000040.html +4 -4
- data/doc/classes/LongDecimal.src/M000041.html +4 -4
- data/doc/classes/LongDecimal.src/M000042.html +4 -6
- data/doc/classes/LongDecimal.src/M000043.html +4 -106
- data/doc/classes/LongDecimal.src/M000044.html +4 -21
- data/doc/classes/LongDecimal.src/M000045.html +4 -11
- data/doc/classes/LongDecimal.src/M000046.html +6 -27
- data/doc/classes/LongDecimal.src/M000047.html +103 -16
- data/doc/classes/LongDecimal.src/M000048.html +21 -4
- data/doc/classes/LongDecimal.src/M000049.html +10 -14
- data/doc/classes/LongDecimal.src/M000050.html +22 -36
- data/doc/classes/LongDecimal.src/M000051.html +34 -4
- data/doc/classes/LongDecimal.src/M000052.html +17 -6
- data/doc/classes/LongDecimal.src/M000053.html +4 -6
- data/doc/classes/LongDecimal.src/M000054.html +15 -4
- data/doc/classes/LongDecimal.src/M000055.html +44 -12
- data/doc/classes/LongDecimal.src/M000056.html +4 -7
- data/doc/classes/LongDecimal.src/M000057.html +8 -4
- data/doc/classes/LongDecimal.src/M000058.html +6 -15
- data/doc/classes/LongDecimal.src/M000059.html +4 -13
- data/doc/classes/LongDecimal.src/M000060.html +15 -4
- data/doc/classes/LongDecimal.src/M000061.html +7 -5
- data/doc/classes/LongDecimal.src/M000062.html +4 -4
- data/doc/classes/LongDecimal.src/M000063.html +15 -5
- data/doc/classes/LongDecimal.src/M000064.html +13 -5
- data/doc/classes/LongDecimal.src/M000065.html +4 -4
- data/doc/classes/LongDecimal.src/M000067.html +4 -8
- data/doc/classes/LongDecimal.src/M000068.html +5 -9
- data/doc/classes/LongDecimal.src/M000069.html +5 -9
- data/doc/classes/LongDecimal.src/M000070.html +4 -9
- data/doc/classes/LongDecimal.src/M000071.html +4 -4
- data/doc/classes/LongDecimal.src/M000072.html +6 -17
- data/doc/classes/LongDecimal.src/M000073.html +7 -7
- data/doc/classes/LongDecimal.src/M000074.html +7 -7
- data/doc/classes/LongDecimal.src/M000075.html +7 -19
- data/doc/classes/LongDecimal.src/M000076.html +4 -8
- data/doc/classes/LongDecimal.src/M000077.html +19 -5
- data/doc/classes/LongDecimal.src/M000078.html +7 -7
- data/doc/classes/LongDecimal.src/M000079.html +7 -7
- data/doc/classes/LongDecimal.src/M000080.html +19 -7
- data/doc/classes/LongDecimal.src/M000081.html +8 -4
- data/doc/classes/LongDecimal.src/M000082.html +5 -7
- data/doc/classes/LongDecimal.src/M000083.html +8 -6
- data/doc/classes/LongDecimal.src/M000084.html +9 -4
- data/doc/classes/LongDecimal.src/M000085.html +9 -4
- data/doc/classes/LongDecimal.src/M000086.html +4 -9
- data/doc/classes/LongDecimal.src/M000087.html +6 -8
- data/doc/classes/LongDecimal.src/M000088.html +7 -5
- data/doc/classes/LongDecimal.src/M000089.html +4 -9
- data/doc/classes/LongDecimal.src/M000090.html +4 -4
- data/doc/classes/LongDecimal.src/M000091.html +9 -4
- data/doc/classes/LongDecimal.src/M000092.html +9 -4
- data/doc/classes/LongDecimal.src/M000093.html +5 -4
- data/doc/classes/LongDecimal.src/M000094.html +7 -57
- data/doc/classes/LongDecimal.src/M000095.html +4 -4
- data/doc/classes/LongDecimal.src/M000096.html +4 -4
- data/doc/classes/LongDecimal.src/M000097.html +4 -5
- data/doc/classes/LongDecimal.src/M000098.html +4 -5
- data/doc/classes/LongDecimal.src/M000099.html +59 -5
- data/doc/classes/LongDecimal.src/M000100.html +4 -5
- data/doc/classes/LongDecimal.src/M000101.html +4 -4
- data/doc/classes/LongDecimal.src/M000104.html +19 -0
- data/doc/classes/LongDecimal.src/M000105.html +19 -0
- data/doc/classes/LongDecimal.src/M000106.html +18 -0
- data/doc/classes/LongDecimal.src/M000107.html +18 -0
- data/doc/classes/LongDecimal.src/M000108.html +18 -0
- data/doc/classes/LongDecimal.src/M000109.html +18 -0
- data/doc/classes/LongDecimalBase.html +69 -66
- data/doc/classes/LongDecimalBase.src/M000113.html +4 -9
- data/doc/classes/LongDecimalBase.src/M000114.html +4 -5
- data/doc/classes/LongDecimalBase.src/M000115.html +4 -9
- data/doc/classes/LongDecimalBase.src/M000116.html +4 -9
- data/doc/classes/LongDecimalBase.src/M000117.html +4 -5
- data/doc/classes/LongDecimalBase.src/M000118.html +23 -0
- data/doc/classes/LongDecimalBase.src/M000121.html +23 -0
- data/doc/classes/LongDecimalBase.src/M000122.html +19 -0
- data/doc/classes/LongDecimalBase.src/M000123.html +18 -0
- data/doc/classes/LongDecimalQuot.html +33 -27
- data/doc/classes/LongDecimalQuot.src/M000003.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000004.html +1 -1
- 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/M000030.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000031.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000034.html +1 -1
- data/doc/classes/LongDecimalQuot.src/M000035.html +1 -1
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.html +25 -24
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000156.html +22 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000157.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000158.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000159.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000161.html +25 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000162.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000163.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000164.html +18 -0
- data/doc/classes/LongDecimalRoundingMode/ZeroRoundingModeClass.html +178 -0
- data/doc/classes/LongDecimalRoundingMode/ZeroRoundingModeClass.src/M000165.html +25 -0
- data/doc/classes/LongDecimalRoundingMode/ZeroRoundingModeClass.src/M000166.html +18 -0
- data/doc/classes/LongDecimalRoundingMode.html +41 -4
- data/doc/classes/LongMath/CacheKey.html +10 -10
- data/doc/classes/LongMath/CacheKey.src/M000155.html +36 -0
- data/doc/classes/LongMath/CacheKey.src/M000160.html +36 -0
- data/doc/classes/LongMath.html +246 -235
- data/doc/classes/LongMath.src/M000124.html +5 -18
- data/doc/classes/LongMath.src/M000125.html +4 -18
- data/doc/classes/LongMath.src/M000126.html +4 -5
- data/doc/classes/LongMath.src/M000127.html +5 -29
- data/doc/classes/LongMath.src/M000128.html +4 -5
- data/doc/classes/LongMath.src/M000129.html +14 -53
- data/doc/classes/LongMath.src/M000130.html +17 -20
- data/doc/classes/LongMath.src/M000131.html +5 -36
- data/doc/classes/LongMath.src/M000132.html +29 -6
- data/doc/classes/LongMath.src/M000133.html +5 -33
- data/doc/classes/LongMath.src/M000134.html +47 -41
- data/doc/classes/LongMath.src/M000135.html +21 -7
- data/doc/classes/LongMath.src/M000136.html +36 -4
- data/doc/classes/LongMath.src/M000137.html +6 -4
- data/doc/classes/LongMath.src/M000138.html +31 -70
- data/doc/classes/LongMath.src/M000139.html +45 -38
- data/doc/classes/LongMath.src/M000140.html +7 -4
- data/doc/classes/LongMath.src/M000141.html +4 -4
- data/doc/classes/LongMath.src/M000142.html +4 -6
- data/doc/classes/LongMath.src/M000143.html +67 -14
- data/doc/classes/LongMath.src/M000144.html +39 -14
- data/doc/classes/LongMath.src/M000145.html +4 -44
- data/doc/classes/LongMath.src/M000146.html +5 -339
- data/doc/classes/LongMath.src/M000147.html +6 -25
- data/doc/classes/LongMath.src/M000148.html +14 -75
- data/doc/classes/LongMath.src/M000149.html +33 -0
- data/doc/classes/LongMath.src/M000150.html +58 -0
- data/doc/classes/LongMath.src/M000151.html +406 -0
- data/doc/classes/LongMath.src/M000152.html +63 -0
- data/doc/classes/LongMath.src/M000153.html +117 -0
- data/doc/classes/LongMath.src/M000154.html +150 -0
- data/doc/classes/LongMath.src/M000155.html +63 -0
- data/doc/classes/LongMath.src/M000156.html +18 -0
- data/doc/classes/LongMath.src/M000157.html +19 -0
- data/doc/classes/LongMath.src/M000158.html +18 -0
- data/doc/classes/LongMath.src/M000159.html +19 -0
- data/doc/classes/Numeric.html +23 -21
- data/doc/classes/Numeric.src/M000106.html +18 -0
- data/doc/classes/Numeric.src/M000110.html +23 -0
- data/doc/classes/Numeric.src/M000111.html +18 -0
- data/doc/classes/Rational.html +18 -16
- data/doc/classes/Rational.src/M000107.html +23 -0
- data/doc/classes/Rational.src/M000112.html +23 -0
- data/doc/created.rid +1 -1
- data/doc/dot/f_0.dot +23 -1
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/m_0_0.png +0 -0
- data/doc/dot/m_0_1.dot +13 -0
- data/doc/dot/m_0_1.png +0 -0
- data/doc/files/lib/long-decimal_rb.html +15 -13
- 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_class_index.html +2 -0
- data/doc/fr_method_index.html +131 -124
- data/lib/long-decimal.rb +373 -49
- data/test/testlongdecimal.rb +689 -7
- data/test/testlongdeclib.rb +51 -11
- data/test/testrandlib.rb +23 -7
- data/test/testrandom.rb +4 -4
- data/test/testrandpower.rb +11 -9
- metadata +48 -3
|
@@ -5,15 +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-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1403</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>
|
|
17
71
|
<span class="ruby-keyword kw">end</span></pre>
|
|
18
72
|
</body>
|
|
19
73
|
</html>
|
|
@@ -5,15 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title
|
|
8
|
+
<title>is_int? (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-
|
|
15
|
-
<span class="ruby-
|
|
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>
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1465</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>
|
|
17
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
18
17
|
</body>
|
|
19
18
|
</html>
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>sgn (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
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1475</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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
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>== (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 1487</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>
|
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
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>=== (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 1497</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>
|
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
18
|
+
</body>
|
|
19
|
+
</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>zero? (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 1506</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
|
+
<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>one? (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 1514</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
|
+
<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>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 1521</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 1528</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>
|
|
@@ -81,18 +81,20 @@
|
|
|
81
81
|
<div id="contextContent">
|
|
82
82
|
<div id="diagram">
|
|
83
83
|
<map id="map" name="map">
|
|
84
|
-
<area shape="
|
|
85
|
-
<area shape="
|
|
86
|
-
<area shape="
|
|
87
|
-
<area shape="
|
|
88
|
-
<area shape="
|
|
89
|
-
<area shape="
|
|
90
|
-
<area shape="
|
|
91
|
-
<area shape="
|
|
92
|
-
<area shape="
|
|
93
|
-
<area shape="
|
|
84
|
+
<area shape="rect" coords="94,7,171,55" href="Comparable.html" alt="Comparable" />
|
|
85
|
+
<area shape="rect" coords="158,206,235,254" href="LongMath/CacheKey.html" alt="CacheKey" />
|
|
86
|
+
<area shape="rect" coords="231,103,356,151" href="LongDecimalRoundingMode/RoundingModeClass.html" alt="RoundingModeClass" />
|
|
87
|
+
<area shape="rect" coords="58,103,207,151" href="LongDecimalRoundingMode/ZeroRoundingModeClass.html" alt="ZeroRoundingModeClass" />
|
|
88
|
+
<area shape="rect" coords="355,206,470,254" href="LongDecimalBase.html" alt="LongDecimalBase" />
|
|
89
|
+
<area shape="rect" coords="294,302,406,350" href="LongDecimalQuot.html" alt="LongDecimalQuot" />
|
|
90
|
+
<area shape="rect" coords="195,7,267,55" href="Integer.html" alt="Integer" />
|
|
91
|
+
<area shape="rect" coords="430,302,520,350" href="LongDecimal.html" alt="LongDecimal" />
|
|
92
|
+
<area shape="rect" coords="407,103,479,151" href="Numeric.html" alt="Numeric" />
|
|
93
|
+
<area shape="rect" coords="291,7,363,55" href="Rational.html" alt="Rational" />
|
|
94
|
+
<area shape="rect" coords="147,172,272,264" href="LongMath.html" alt="LongMath" />
|
|
95
|
+
<area shape="rect" coords="47,70,394,162" href="LongDecimalRoundingMode.html" alt="LongDecimalRoundingMode" />
|
|
94
96
|
</map>
|
|
95
|
-
<img src="../dot/f_0.png" usemap="#map" border=0 alt="
|
|
97
|
+
<img src="../dot/f_0.png" usemap="#map" border="0" alt="dot/f_0.png">
|
|
96
98
|
</div>
|
|
97
99
|
|
|
98
100
|
<div id="description">
|
|
@@ -110,17 +112,17 @@ href="LongDecimalQuot.html">LongDecimalQuot</a>
|
|
|
110
112
|
<h3 class="section-bar">Methods</h3>
|
|
111
113
|
|
|
112
114
|
<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="#
|
|
115
|
+
<a href="#M000116">+@</a>
|
|
116
|
+
<a href="#M000121"><=></a>
|
|
117
|
+
<a href="#M000120">abs2</a>
|
|
118
|
+
<a href="#M000115">dec</a>
|
|
119
|
+
<a href="#M000114">inc</a>
|
|
120
|
+
<a href="#M000119">inverse</a>
|
|
121
|
+
<a href="#M000118">reciprocal</a>
|
|
122
|
+
<a href="#M000123">scale_equal</a>
|
|
123
|
+
<a href="#M000122">scale_ufo</a>
|
|
124
|
+
<a href="#M000117">square</a>
|
|
125
|
+
<a href="#M000113">to_r</a>
|
|
124
126
|
</div>
|
|
125
127
|
</div>
|
|
126
128
|
|
|
@@ -149,12 +151,12 @@ href="LongDecimalQuot.html">LongDecimalQuot</a>
|
|
|
149
151
|
<div id="methods">
|
|
150
152
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
151
153
|
|
|
152
|
-
<div id="method-
|
|
153
|
-
<a name="
|
|
154
|
+
<div id="method-M000116" class="method-detail">
|
|
155
|
+
<a name="M000116"></a>
|
|
154
156
|
|
|
155
157
|
<div class="method-heading">
|
|
156
|
-
<a href="LongDecimalBase.src/
|
|
157
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
158
|
+
<a href="LongDecimalBase.src/M000116.html" target="Code" class="method-signature"
|
|
159
|
+
onclick="popupCode('LongDecimalBase.src/M000116.html');return false;">
|
|
158
160
|
<span class="method-name">+@</span><span class="method-args">()</span>
|
|
159
161
|
</a>
|
|
160
162
|
</div>
|
|
@@ -166,12 +168,12 @@ unary plus returns self
|
|
|
166
168
|
</div>
|
|
167
169
|
</div>
|
|
168
170
|
|
|
169
|
-
<div id="method-
|
|
170
|
-
<a name="
|
|
171
|
+
<div id="method-M000121" class="method-detail">
|
|
172
|
+
<a name="M000121"></a>
|
|
171
173
|
|
|
172
174
|
<div class="method-heading">
|
|
173
|
-
<a href="LongDecimalBase.src/
|
|
174
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
175
|
+
<a href="LongDecimalBase.src/M000121.html" target="Code" class="method-signature"
|
|
176
|
+
onclick="popupCode('LongDecimalBase.src/M000121.html');return false;">
|
|
175
177
|
<span class="method-name"><=></span><span class="method-args">(other)</span>
|
|
176
178
|
</a>
|
|
177
179
|
</div>
|
|
@@ -193,8 +195,8 @@ of potentially zero digits after the decimal point.
|
|
|
193
195
|
</div>
|
|
194
196
|
</div>
|
|
195
197
|
|
|
196
|
-
<div id="method-
|
|
197
|
-
<a name="
|
|
198
|
+
<div id="method-M000120" class="method-detail">
|
|
199
|
+
<a name="M000120"></a>
|
|
198
200
|
|
|
199
201
|
<div class="method-heading">
|
|
200
202
|
<span class="method-name">abs2</span><span class="method-args">()</span>
|
|
@@ -202,17 +204,17 @@ of potentially zero digits after the decimal point.
|
|
|
202
204
|
|
|
203
205
|
<div class="method-description">
|
|
204
206
|
<p>
|
|
205
|
-
Alias for <a href="LongDecimalBase.html#
|
|
207
|
+
Alias for <a href="LongDecimalBase.html#M000117">square</a>
|
|
206
208
|
</p>
|
|
207
209
|
</div>
|
|
208
210
|
</div>
|
|
209
211
|
|
|
210
|
-
<div id="method-
|
|
211
|
-
<a name="
|
|
212
|
+
<div id="method-M000115" class="method-detail">
|
|
213
|
+
<a name="M000115"></a>
|
|
212
214
|
|
|
213
215
|
<div class="method-heading">
|
|
214
|
-
<a href="LongDecimalBase.src/
|
|
215
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
216
|
+
<a href="LongDecimalBase.src/M000115.html" target="Code" class="method-signature"
|
|
217
|
+
onclick="popupCode('LongDecimalBase.src/M000115.html');return false;">
|
|
216
218
|
<span class="method-name">dec</span><span class="method-args">()</span>
|
|
217
219
|
</a>
|
|
218
220
|
</div>
|
|
@@ -224,12 +226,12 @@ self - 1
|
|
|
224
226
|
</div>
|
|
225
227
|
</div>
|
|
226
228
|
|
|
227
|
-
<div id="method-
|
|
228
|
-
<a name="
|
|
229
|
+
<div id="method-M000114" class="method-detail">
|
|
230
|
+
<a name="M000114"></a>
|
|
229
231
|
|
|
230
232
|
<div class="method-heading">
|
|
231
|
-
<a href="LongDecimalBase.src/
|
|
232
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
233
|
+
<a href="LongDecimalBase.src/M000114.html" target="Code" class="method-signature"
|
|
234
|
+
onclick="popupCode('LongDecimalBase.src/M000114.html');return false;">
|
|
233
235
|
<span class="method-name">inc</span><span class="method-args">()</span>
|
|
234
236
|
</a>
|
|
235
237
|
</div>
|
|
@@ -241,8 +243,8 @@ self + 1
|
|
|
241
243
|
</div>
|
|
242
244
|
</div>
|
|
243
245
|
|
|
244
|
-
<div id="method-
|
|
245
|
-
<a name="
|
|
246
|
+
<div id="method-M000119" class="method-detail">
|
|
247
|
+
<a name="M000119"></a>
|
|
246
248
|
|
|
247
249
|
<div class="method-heading">
|
|
248
250
|
<span class="method-name">inverse</span><span class="method-args">()</span>
|
|
@@ -250,34 +252,35 @@ self + 1
|
|
|
250
252
|
|
|
251
253
|
<div class="method-description">
|
|
252
254
|
<p>
|
|
253
|
-
Alias for <a href="LongDecimalBase.html#
|
|
255
|
+
Alias for <a href="LongDecimalBase.html#M000118">reciprocal</a>
|
|
254
256
|
</p>
|
|
255
257
|
</div>
|
|
256
258
|
</div>
|
|
257
259
|
|
|
258
|
-
<div id="method-
|
|
259
|
-
<a name="
|
|
260
|
+
<div id="method-M000118" class="method-detail">
|
|
261
|
+
<a name="M000118"></a>
|
|
260
262
|
|
|
261
263
|
<div class="method-heading">
|
|
262
|
-
<a href="LongDecimalBase.src/
|
|
263
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
264
|
+
<a href="LongDecimalBase.src/M000118.html" target="Code" class="method-signature"
|
|
265
|
+
onclick="popupCode('LongDecimalBase.src/M000118.html');return false;">
|
|
264
266
|
<span class="method-name">reciprocal</span><span class="method-args">()</span>
|
|
265
267
|
</a>
|
|
266
268
|
</div>
|
|
267
269
|
|
|
268
270
|
<div class="method-description">
|
|
269
271
|
<p>
|
|
270
|
-
calculate the multiplicative
|
|
272
|
+
calculate the multiplicative <a
|
|
273
|
+
href="LongDecimalBase.html#M000119">inverse</a>
|
|
271
274
|
</p>
|
|
272
275
|
</div>
|
|
273
276
|
</div>
|
|
274
277
|
|
|
275
|
-
<div id="method-
|
|
276
|
-
<a name="
|
|
278
|
+
<div id="method-M000123" class="method-detail">
|
|
279
|
+
<a name="M000123"></a>
|
|
277
280
|
|
|
278
281
|
<div class="method-heading">
|
|
279
|
-
<a href="LongDecimalBase.src/
|
|
280
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
282
|
+
<a href="LongDecimalBase.src/M000123.html" target="Code" class="method-signature"
|
|
283
|
+
onclick="popupCode('LongDecimalBase.src/M000123.html');return false;">
|
|
281
284
|
<span class="method-name">scale_equal</span><span class="method-args">(other)</span>
|
|
282
285
|
</a>
|
|
283
286
|
</div>
|
|
@@ -287,12 +290,12 @@ calculate the multiplicative inverse
|
|
|
287
290
|
</div>
|
|
288
291
|
</div>
|
|
289
292
|
|
|
290
|
-
<div id="method-
|
|
291
|
-
<a name="
|
|
293
|
+
<div id="method-M000122" class="method-detail">
|
|
294
|
+
<a name="M000122"></a>
|
|
292
295
|
|
|
293
296
|
<div class="method-heading">
|
|
294
|
-
<a href="LongDecimalBase.src/
|
|
295
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
297
|
+
<a href="LongDecimalBase.src/M000122.html" target="Code" class="method-signature"
|
|
298
|
+
onclick="popupCode('LongDecimalBase.src/M000122.html');return false;">
|
|
296
299
|
<span class="method-name">scale_ufo</span><span class="method-args">(other)</span>
|
|
297
300
|
</a>
|
|
298
301
|
</div>
|
|
@@ -304,29 +307,29 @@ calculate the multiplicative inverse
|
|
|
304
307
|
</div>
|
|
305
308
|
</div>
|
|
306
309
|
|
|
307
|
-
<div id="method-
|
|
308
|
-
<a name="
|
|
310
|
+
<div id="method-M000117" class="method-detail">
|
|
311
|
+
<a name="M000117"></a>
|
|
309
312
|
|
|
310
313
|
<div class="method-heading">
|
|
311
|
-
<a href="LongDecimalBase.src/
|
|
312
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
314
|
+
<a href="LongDecimalBase.src/M000117.html" target="Code" class="method-signature"
|
|
315
|
+
onclick="popupCode('LongDecimalBase.src/M000117.html');return false;">
|
|
313
316
|
<span class="method-name">square</span><span class="method-args">()</span>
|
|
314
317
|
</a>
|
|
315
318
|
</div>
|
|
316
319
|
|
|
317
320
|
<div class="method-description">
|
|
318
321
|
<p>
|
|
319
|
-
calculate the square of self
|
|
322
|
+
calculate the <a href="LongDecimalBase.html#M000117">square</a> of self
|
|
320
323
|
</p>
|
|
321
324
|
</div>
|
|
322
325
|
</div>
|
|
323
326
|
|
|
324
|
-
<div id="method-
|
|
325
|
-
<a name="
|
|
327
|
+
<div id="method-M000113" class="method-detail">
|
|
328
|
+
<a name="M000113"></a>
|
|
326
329
|
|
|
327
330
|
<div class="method-heading">
|
|
328
|
-
<a href="LongDecimalBase.src/
|
|
329
|
-
onclick="popupCode('LongDecimalBase.src/
|
|
331
|
+
<a href="LongDecimalBase.src/M000113.html" target="Code" class="method-signature"
|
|
332
|
+
onclick="popupCode('LongDecimalBase.src/M000113.html');return false;">
|
|
330
333
|
<span class="method-name">to_r</span><span class="method-args">()</span>
|
|
331
334
|
</a>
|
|
332
335
|
</div>
|
|
@@ -5,19 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>to_r (LongDecimalBase)</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-
|
|
16
|
-
<span class="ruby-identifier">dx</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sint_digits10</span>
|
|
17
|
-
<span class="ruby-identifier">new_scale</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">dx</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">sx</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>].<span class="ruby-identifier">max</span>
|
|
18
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-value">1</span> <span class="ruby-operator">/</span> <span class="ruby-keyword kw">self</span>
|
|
19
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">scale</span> = <span class="ruby-identifier">new_scale</span>
|
|
20
|
-
<span class="ruby-identifier">result</span>
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 326</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_r</span>
|
|
15
|
+
<span class="ruby-constant">Rational</span>(<span class="ruby-identifier">numerator</span>, <span class="ruby-identifier">denominator</span>)
|
|
21
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
22
17
|
</body>
|
|
23
18
|
</html>
|
|
@@ -5,15 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>inc (LongDecimalBase)</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-
|
|
16
|
-
<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>
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 333</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inc</span>
|
|
15
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
|
17
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
18
17
|
</body>
|
|
19
18
|
</html>
|
|
@@ -5,19 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title
|
|
8
|
+
<title>dec (LongDecimalBase)</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-
|
|
15
|
-
<span class="ruby-
|
|
16
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">diff</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalBase</span>) <span class="ruby-keyword kw">then</span>
|
|
17
|
-
<span class="ruby-identifier">diff</span>.<span class="ruby-identifier">sgn</span>
|
|
18
|
-
<span class="ruby-keyword kw">else</span>
|
|
19
|
-
<span class="ruby-identifier">diff</span> <span class="ruby-operator"><=></span> <span class="ruby-value">0</span>
|
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 340</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dec</span>
|
|
15
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
|
21
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
22
17
|
</body>
|
|
23
18
|
</html>
|