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,19 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title
|
|
8
|
+
<title>+@ (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-operator"
|
|
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 347</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">+@</span>
|
|
15
|
+
<span class="ruby-keyword kw">self</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>square (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 354</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">square</span>
|
|
15
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">*</span> <span class="ruby-keyword kw">self</span>
|
|
17
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
18
17
|
</body>
|
|
19
18
|
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
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>reciprocal (LongDecimalBase)</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 361</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reciprocal</span>
|
|
15
|
+
<span class="ruby-identifier">sx</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scale</span>
|
|
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>
|
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
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><=> (LongDecimalBase)</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 391</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span> (<span class="ruby-identifier">other</span>)
|
|
15
|
+
<span class="ruby-identifier">diff</span> = (<span class="ruby-keyword kw">self</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">other</span>)
|
|
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>
|
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
22
|
+
</body>
|
|
23
|
+
</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>scale_ufo (LongDecimalBase)</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 403</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scale_ufo</span>(<span class="ruby-identifier">other</span>)
|
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">"only works for LongDecimal or LongDecimalQuot"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalBase</span>)
|
|
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>
|
|
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>scale_equal (LongDecimalBase)</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 411</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scale_equal</span>(<span class="ruby-identifier">other</span>)
|
|
15
|
+
<span class="ruby-identifier">scale_ufo</span>(<span class="ruby-identifier">other</span>).<span class="ruby-identifier">zero?</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">
|
|
@@ -163,7 +165,7 @@ information on how to round the result.
|
|
|
163
165
|
<table summary="aliases">
|
|
164
166
|
<tr class="top-aligned-row context-row">
|
|
165
167
|
<td class="context-item-name">square</td>
|
|
166
|
-
<td
|
|
168
|
+
<td>-></td>
|
|
167
169
|
<td class="context-item-value">abs2</td>
|
|
168
170
|
</tr>
|
|
169
171
|
<tr class="top-aligned-row context-row">
|
|
@@ -215,8 +217,9 @@ square of absolute value happens to be the square
|
|
|
215
217
|
|
|
216
218
|
<div class="method-description">
|
|
217
219
|
<p>
|
|
218
|
-
create a
|
|
219
|
-
|
|
220
|
+
create a <a href="LongDecimalQuot.html#M000004">new</a> <a
|
|
221
|
+
href="LongDecimalQuot.html">LongDecimalQuot</a> from a rational and a scale
|
|
222
|
+
or a pair of LongDecimals
|
|
220
223
|
</p>
|
|
221
224
|
</div>
|
|
222
225
|
</div>
|
|
@@ -234,9 +237,9 @@ rational and a scale or a pair of LongDecimals
|
|
|
234
237
|
<div class="method-description">
|
|
235
238
|
<p>
|
|
236
239
|
constructor first, second is either a pair of LongDecimals or a <a
|
|
237
|
-
href="Rational.html">Rational</a> and an
|
|
238
|
-
href="LongDecimal.html">LongDecimal</a> will contain a
|
|
239
|
-
dividing the two LongDecimals or by taking the <a
|
|
240
|
+
href="Rational.html">Rational</a> and an <a href="Integer.html">Integer</a>
|
|
241
|
+
The resulting <a href="LongDecimal.html">LongDecimal</a> will contain a
|
|
242
|
+
rational obtained by dividing the two LongDecimals or by taking the <a
|
|
240
243
|
href="Rational.html">Rational</a> as it is. The scale is there to provide a
|
|
241
244
|
default rounding precision for conversion to <a
|
|
242
245
|
href="LongDecimal.html">LongDecimal</a>, but it has no influence on the
|
|
@@ -434,13 +437,15 @@ Absolute value
|
|
|
434
437
|
<div class="method-description">
|
|
435
438
|
<p>
|
|
436
439
|
prepare binary operation of other with <a
|
|
437
|
-
href="LongDecimalQuot.html">LongDecimalQuot</a>
|
|
440
|
+
href="LongDecimalQuot.html">LongDecimalQuot</a> <a
|
|
441
|
+
href="Integer.html">Integer</a>, <a
|
|
438
442
|
href="LongDecimal.html">LongDecimal</a>, <a
|
|
439
443
|
href="Rational.html">Rational</a> and <a
|
|
440
444
|
href="LongDecimalQuot.html">LongDecimalQuot</a> can be expressed as <a
|
|
441
445
|
href="LongDecimalQuot.html">LongDecimalQuot</a>, using the scale of self in
|
|
442
|
-
case of
|
|
443
|
-
|
|
446
|
+
case of <a href="Integer.html">Integer</a> and <a
|
|
447
|
+
href="Rational.html">Rational</a>. Floats can be approximated by
|
|
448
|
+
LongDecimals and thus be expressed as <a
|
|
444
449
|
href="LongDecimalQuot.html">LongDecimalQuot</a> In case of BigDecimal,
|
|
445
450
|
Complex or any unknown type, convert self to BigDecimal or Float.
|
|
446
451
|
</p>
|
|
@@ -476,8 +481,8 @@ self -= 1
|
|
|
476
481
|
|
|
477
482
|
<div class="method-description">
|
|
478
483
|
<p>
|
|
479
|
-
denominator of the included
|
|
480
|
-
like Rationals
|
|
484
|
+
<a href="LongDecimalQuot.html#M000006">denominator</a> of the included
|
|
485
|
+
rational number. LongDecimals should duck type like Rationals
|
|
481
486
|
</p>
|
|
482
487
|
</div>
|
|
483
488
|
</div>
|
|
@@ -512,7 +517,8 @@ is non-negative and less or equal the divisor.
|
|
|
512
517
|
|
|
513
518
|
<div class="method-description">
|
|
514
519
|
<p>
|
|
515
|
-
Returns a hash code for the
|
|
520
|
+
Returns a <a href="LongDecimalQuot.html#M000034">hash</a> code for the
|
|
521
|
+
complex number.
|
|
516
522
|
</p>
|
|
517
523
|
</div>
|
|
518
524
|
</div>
|
|
@@ -582,8 +588,8 @@ is self expressable as an integer without loss of digits?
|
|
|
582
588
|
|
|
583
589
|
<div class="method-description">
|
|
584
590
|
<p>
|
|
585
|
-
numerator of the included
|
|
586
|
-
like Rationals
|
|
591
|
+
<a href="LongDecimalQuot.html#M000005">numerator</a> of the included
|
|
592
|
+
rational number. LongDecimals should duck type like Rationals
|
|
587
593
|
</p>
|
|
588
594
|
</div>
|
|
589
595
|
</div>
|
|
@@ -654,7 +660,7 @@ alter scale (only for internal use)
|
|
|
654
660
|
|
|
655
661
|
<div class="method-description">
|
|
656
662
|
<p>
|
|
657
|
-
sign of self
|
|
663
|
+
<a href="LongDecimalQuot.html#M000033">sign</a> of self
|
|
658
664
|
</p>
|
|
659
665
|
</div>
|
|
660
666
|
</div>
|
|
@@ -755,7 +761,7 @@ convert into Float
|
|
|
755
761
|
|
|
756
762
|
<div class="method-description">
|
|
757
763
|
<p>
|
|
758
|
-
convert into Integer
|
|
764
|
+
convert into <a href="Integer.html">Integer</a>
|
|
759
765
|
</p>
|
|
760
766
|
</div>
|
|
761
767
|
</div>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1552</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongDecimalQuot</span>.<span class="ruby-identifier">new!</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>)
|
|
15
15
|
<span class="ruby-identifier">new</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>)
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1560</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>)
|
|
15
15
|
<span class="ruby-ivar">@digits10</span> = <span class="ruby-keyword kw">nil</span>
|
|
16
16
|
<span class="ruby-keyword kw">if</span> ((<span class="ruby-identifier">first</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Rational</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">first</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>)) <span class="ruby-operator">&&</span> (<span class="ruby-identifier">second</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>) <span class="ruby-keyword kw">then</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1598</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">numerator</span>
|
|
15
15
|
<span class="ruby-identifier">rat</span>.<span class="ruby-identifier">numerator</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1606</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">denominator</span>
|
|
15
15
|
<span class="ruby-identifier">rat</span>.<span class="ruby-identifier">denominator</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1613</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scale=</span>(<span class="ruby-identifier">s</span>)
|
|
15
15
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"non integer arg \"#{s.inspect}\""</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>
|
|
16
16
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"negative arg \"#{s.inspect}\""</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</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/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1624</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
|
15
15
|
<span class="ruby-identifier">str</span> = <span class="ruby-ivar">@rat</span>.<span class="ruby-identifier">to_s</span>
|
|
16
16
|
<span class="ruby-identifier">str</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"["</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">scale</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"]"</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1632</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_f</span>
|
|
15
15
|
<span class="ruby-identifier">to_r</span>.<span class="ruby-identifier">to_f</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1639</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bd</span>
|
|
15
15
|
<span class="ruby-identifier">to_ld</span>.<span class="ruby-identifier">to_bd</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1646</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span>
|
|
15
15
|
<span class="ruby-identifier">to_r</span>.<span class="ruby-identifier">to_i</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1655</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ld</span>(<span class="ruby-identifier">prec</span> = <span class="ruby-identifier">scale</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">standard_mode</span>)
|
|
15
15
|
<span class="ruby-identifier">round_to_scale</span>(<span class="ruby-identifier">prec</span>, <span class="ruby-identifier">mode</span>)
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1674</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sint_digits10</span>
|
|
15
15
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@digits10</span>.<span class="ruby-identifier">nil?</span>)
|
|
16
16
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zero?</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1695</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inc!</span>
|
|
15
15
|
<span class="ruby-ivar">@rat</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
|
16
16
|
<span class="ruby-ivar">@digits10</span> = <span class="ruby-keyword kw">nil</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1703</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dec!</span>
|
|
15
15
|
<span class="ruby-ivar">@rat</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
|
|
16
16
|
<span class="ruby-ivar">@digits10</span> = <span class="ruby-keyword kw">nil</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1712</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">-@</span>
|
|
15
15
|
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">then</span>
|
|
16
16
|
<span class="ruby-keyword kw">self</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1726</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span> = <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">other</span>)
|
|
16
16
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalQuot</span>) <span class="ruby-keyword kw">then</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1741</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span> = <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">other</span>)
|
|
16
16
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalQuot</span>) <span class="ruby-keyword kw">then</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1756</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">*</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span> = <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">other</span>)
|
|
16
16
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalQuot</span>) <span class="ruby-keyword kw">then</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1771</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">/</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-identifier">o</span>, <span class="ruby-identifier">s</span> = <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">other</span>)
|
|
16
16
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalQuot</span>) <span class="ruby-keyword kw">then</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1786</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">**</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalBase</span>) <span class="ruby-keyword kw">then</span>
|
|
16
16
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">is_int?</span> <span class="ruby-keyword kw">then</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1813</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">divmod</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-keyword kw">if</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>
|
|
16
16
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">"divmod not supported for Complex"</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1825</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">%</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
<span class="ruby-identifier">q</span>, <span class="ruby-identifier">r</span> = <span class="ruby-identifier">divmod</span> <span class="ruby-identifier">other</span>
|
|
16
16
|
<span class="ruby-identifier">r</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1833</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abs</span>
|
|
15
15
|
<span class="ruby-constant">LongDecimalQuot</span>(<span class="ruby-identifier">rat</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">scale</span>)
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1847</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">round_to_scale</span>(<span class="ruby-identifier">new_scale</span> = <span class="ruby-ivar">@scale</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-constant">ROUND_UNNECESSARY</span>)
|
|
15
15
|
|
|
16
16
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"new_scale #{new_scale.inspect} must be integer"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">new_scale</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 1969</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
|
|
16
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>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 2017</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
|
|
15
15
|
(<span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimalQuot</span>) <span class="ruby-operator">&&</span> (<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 2025</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zero?</span>
|
|
15
15
|
<span class="ruby-ivar">@rat</span>.<span class="ruby-identifier">zero?</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 2033</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">one?</span>
|
|
15
15
|
(<span class="ruby-ivar">@rat</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/long-decimal.rb, line 2040</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_int?</span>
|
|
15
15
|
<span class="ruby-identifier">denominator</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|