long-decimal 0.00.08 → 0.00.09
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/doc/classes/LongDecimal.html +1432 -0
- data/doc/classes/LongDecimal.src/M000040.html +18 -0
- data/doc/classes/LongDecimal.src/M000041.html +18 -0
- data/doc/classes/LongDecimal.src/M000042.html +18 -0
- data/doc/classes/LongDecimal.src/M000043.html +18 -0
- data/doc/classes/LongDecimal.src/M000044.html +18 -0
- data/doc/classes/LongDecimal.src/M000045.html +18 -0
- data/doc/classes/LongDecimal.src/M000046.html +20 -0
- data/doc/classes/LongDecimal.src/M000047.html +109 -0
- data/doc/classes/LongDecimal.src/M000048.html +18 -0
- data/doc/classes/LongDecimal.src/M000049.html +18 -0
- data/doc/classes/LongDecimal.src/M000050.html +34 -0
- data/doc/classes/LongDecimal.src/M000051.html +41 -0
- data/doc/classes/LongDecimal.src/M000052.html +35 -0
- data/doc/classes/LongDecimal.src/M000053.html +18 -0
- data/doc/classes/LongDecimal.src/M000054.html +29 -0
- data/doc/classes/LongDecimal.src/M000055.html +18 -0
- data/doc/classes/LongDecimal.src/M000056.html +22 -0
- data/doc/classes/LongDecimal.src/M000057.html +18 -0
- data/doc/classes/LongDecimal.src/M000058.html +18 -0
- data/doc/classes/LongDecimal.src/M000059.html +20 -0
- data/doc/classes/LongDecimal.src/M000060.html +18 -0
- data/doc/classes/LongDecimal.src/M000062.html +29 -0
- data/doc/classes/LongDecimal.src/M000063.html +27 -0
- data/doc/classes/LongDecimal.src/M000064.html +18 -0
- data/doc/classes/LongDecimal.src/M000066.html +18 -0
- data/doc/classes/LongDecimal.src/M000067.html +18 -0
- data/doc/classes/LongDecimal.src/M000068.html +18 -0
- data/doc/classes/LongDecimal.src/M000069.html +18 -0
- data/doc/classes/LongDecimal.src/M000070.html +18 -0
- data/doc/classes/LongDecimal.src/M000071.html +22 -0
- data/doc/classes/LongDecimal.src/M000072.html +23 -0
- data/doc/classes/LongDecimal.src/M000073.html +23 -0
- data/doc/classes/LongDecimal.src/M000074.html +23 -0
- data/doc/classes/LongDecimal.src/M000075.html +18 -0
- data/doc/classes/LongDecimal.src/M000076.html +29 -0
- data/doc/classes/LongDecimal.src/M000077.html +23 -0
- data/doc/classes/LongDecimal.src/M000078.html +23 -0
- data/doc/classes/LongDecimal.src/M000079.html +34 -0
- data/doc/classes/LongDecimal.src/M000080.html +22 -0
- data/doc/classes/LongDecimal.src/M000081.html +19 -0
- data/doc/classes/LongDecimal.src/M000082.html +23 -0
- data/doc/classes/LongDecimal.src/M000083.html +23 -0
- data/doc/classes/LongDecimal.src/M000084.html +23 -0
- data/doc/classes/LongDecimal.src/M000085.html +18 -0
- data/doc/classes/LongDecimal.src/M000086.html +21 -0
- data/doc/classes/LongDecimal.src/M000087.html +21 -0
- data/doc/classes/LongDecimal.src/M000088.html +18 -0
- data/doc/classes/LongDecimal.src/M000089.html +18 -0
- data/doc/classes/LongDecimal.src/M000090.html +23 -0
- data/doc/classes/LongDecimal.src/M000091.html +23 -0
- data/doc/classes/LongDecimal.src/M000092.html +19 -0
- data/doc/classes/LongDecimal.src/M000093.html +23 -0
- data/doc/classes/LongDecimal.src/M000094.html +18 -0
- data/doc/classes/LongDecimal.src/M000095.html +30 -0
- data/doc/classes/LongDecimal.src/M000096.html +18 -0
- data/doc/classes/LongDecimal.src/M000097.html +18 -0
- data/doc/classes/LongDecimal.src/M000098.html +18 -0
- data/doc/classes/LongDecimal.src/M000099.html +23 -0
- data/doc/classes/LongDecimal.src/M000100.html +19 -0
- data/doc/classes/LongDecimal.src/M000101.html +18 -0
- data/doc/classes/LongDecimal.src/M000102.html +45 -0
- data/doc/classes/LongDecimal.src/M000103.html +18 -0
- data/doc/classes/LongDecimal.src/M000104.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/LongDecimal.src/M000110.html +18 -0
- data/doc/classes/LongDecimalQuot.html +757 -0
- data/doc/classes/LongDecimalQuot.src/M000003.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000004.html +28 -0
- data/doc/classes/LongDecimalQuot.src/M000005.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000006.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000007.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000008.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000009.html +19 -0
- data/doc/classes/LongDecimalQuot.src/M000010.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000011.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000012.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000013.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000014.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000015.html +22 -0
- data/doc/classes/LongDecimalQuot.src/M000016.html +23 -0
- data/doc/classes/LongDecimalQuot.src/M000017.html +23 -0
- data/doc/classes/LongDecimalQuot.src/M000018.html +23 -0
- data/doc/classes/LongDecimalQuot.src/M000019.html +23 -0
- data/doc/classes/LongDecimalQuot.src/M000020.html +35 -0
- data/doc/classes/LongDecimalQuot.src/M000021.html +22 -0
- data/doc/classes/LongDecimalQuot.src/M000022.html +19 -0
- data/doc/classes/LongDecimalQuot.src/M000023.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000024.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000025.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000026.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000027.html +79 -0
- data/doc/classes/LongDecimalQuot.src/M000028.html +36 -0
- data/doc/classes/LongDecimalQuot.src/M000029.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000030.html +23 -0
- data/doc/classes/LongDecimalQuot.src/M000031.html +19 -0
- data/doc/classes/LongDecimalQuot.src/M000032.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000033.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000034.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000037.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000038.html +18 -0
- data/doc/classes/LongDecimalQuot.src/M000039.html +18 -0
- data/doc/classes/LongDecimalRoundingMode.html +185 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.html +155 -0
- data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000122.html +22 -0
- data/doc/classes/LongMath.html +468 -0
- data/doc/classes/LongMath.src/M000112.html +19 -0
- data/doc/classes/LongMath.src/M000113.html +18 -0
- data/doc/classes/LongMath.src/M000114.html +18 -0
- data/doc/classes/LongMath.src/M000115.html +19 -0
- data/doc/classes/LongMath.src/M000116.html +18 -0
- data/doc/classes/LongMath.src/M000117.html +32 -0
- data/doc/classes/LongMath.src/M000118.html +32 -0
- data/doc/classes/LongMath.src/M000119.html +19 -0
- data/doc/classes/LongMath.src/M000120.html +43 -0
- data/doc/classes/LongMath.src/M000121.html +19 -0
- data/doc/classes/Numeric.html +149 -0
- data/doc/classes/Numeric.src/M000111.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +113 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/m_0_0.dot +40 -0
- data/doc/dot/m_0_0.png +0 -0
- data/doc/dot/m_0_1.dot +49 -0
- data/doc/dot/m_0_1.png +0 -0
- data/doc/files/lib/longdecimal_rb.html +180 -0
- data/doc/files/lib/longdecimal_rb.src/M000001.html +22 -0
- data/doc/files/lib/longdecimal_rb.src/M000002.html +18 -0
- data/doc/fr_class_index.html +32 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +154 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/longdecimal.rb +216 -48
- data/test/testlongdecimal.rb +112 -24
- metadata +149 -2
@@ -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>check_word_len (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 64</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_word_len</span>(<span class="ruby-identifier">word_len</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"word_len"</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name} must be a positive number <= 1024"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">word_len</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Fixnum</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">word_len</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">word_len</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1024</span>
|
16
|
+
<span class="ruby-identifier">word_len</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>check_is_int (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 72</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"x"</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name}=#{x.inspect} must be Integer"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Integer</span>
|
16
|
+
<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>check_is_ld (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 79</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_ld</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"x"</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"x=#{x.inspect} must be LongDecimal"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">LongDecimal</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
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>check_is_prec (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 86</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_prec</span>(<span class="ruby-identifier">prec</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"prec"</span>)
|
15
|
+
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">prec</span>, <span class="ruby-value str">"prec"</span>)
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name}=#{prec.inspect} must be >= 0"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">prec</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>
|
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>check_is_mode (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 94</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">check_is_mode</span>(<span class="ruby-identifier">mode</span>, <span class="ruby-identifier">name</span>=<span class="ruby-value str">"mode"</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{name}=#{mode.inspect} must be legal rounding mode"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">RoundingModeClass</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,32 @@
|
|
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>split_to_words (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 102</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">split_to_words</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">word_len</span> = <span class="ruby-value">32</span>)
|
15
|
+
<span class="ruby-identifier">check_word_len</span>(<span class="ruby-identifier">word_len</span>)
|
16
|
+
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>)
|
17
|
+
<span class="ruby-identifier">m</span> = <span class="ruby-identifier">x</span>.<span class="ruby-identifier">abs</span>
|
18
|
+
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">x</span> <span class="ruby-operator"><=></span> <span class="ruby-value">0</span>)
|
19
|
+
<span class="ruby-identifier">bit_pattern</span> = (<span class="ruby-value">1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">word_len</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
20
|
+
<span class="ruby-identifier">words</span> = []
|
21
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">m</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">words</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">do</span>
|
22
|
+
<span class="ruby-identifier">w</span> = <span class="ruby-identifier">m</span> <span class="ruby-operator">&</span> <span class="ruby-identifier">bit_pattern</span>
|
23
|
+
<span class="ruby-identifier">m</span> = <span class="ruby-identifier">m</span> <span class="ruby-operator">>></span> <span class="ruby-identifier">word_len</span>
|
24
|
+
<span class="ruby-identifier">words</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">w</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span>
|
27
|
+
<span class="ruby-identifier">words</span>[<span class="ruby-value">0</span>] = <span class="ruby-operator">-</span><span class="ruby-identifier">words</span>[<span class="ruby-value">0</span>]
|
28
|
+
<span class="ruby-keyword kw">end</span>
|
29
|
+
<span class="ruby-identifier">words</span>
|
30
|
+
<span class="ruby-keyword kw">end</span></pre>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,32 @@
|
|
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>merge_from_words (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 123</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">merge_from_words</span>(<span class="ruby-identifier">words</span>, <span class="ruby-identifier">word_len</span> = <span class="ruby-value">32</span>)
|
15
|
+
<span class="ruby-identifier">check_word_len</span>(<span class="ruby-identifier">word_len</span>)
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">"words must be array of length > 0"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">words</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">words</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
17
|
+
<span class="ruby-identifier">y</span> = <span class="ruby-value">0</span>
|
18
|
+
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">words</span>[<span class="ruby-value">0</span>] <span class="ruby-operator"><=></span> <span class="ruby-value">0</span>)
|
19
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span>
|
20
|
+
<span class="ruby-identifier">words</span>[<span class="ruby-value">0</span>] = <span class="ruby-operator">-</span><span class="ruby-identifier">words</span>[<span class="ruby-value">0</span>]
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-identifier">words</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span>
|
23
|
+
<span class="ruby-identifier">y</span> = <span class="ruby-identifier">y</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">word_len</span>
|
24
|
+
<span class="ruby-identifier">y</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">w</span>
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span>
|
27
|
+
<span class="ruby-identifier">y</span> = <span class="ruby-operator">-</span><span class="ruby-identifier">y</span>
|
28
|
+
<span class="ruby-keyword kw">end</span>
|
29
|
+
<span class="ruby-identifier">y</span>
|
30
|
+
<span class="ruby-keyword kw">end</span></pre>
|
31
|
+
</body>
|
32
|
+
</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>sqrtb (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 144</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtb</span>(<span class="ruby-identifier">x</span>)
|
15
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">sqrtb_with_remainder</span>(<span class="ruby-identifier">x</span>)
|
16
|
+
<span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>]
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,43 @@
|
|
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>sqrtb_with_remainder (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 155</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtb_with_remainder</span>(<span class="ruby-identifier">x</span>)
|
15
|
+
<span class="ruby-identifier">check_is_int</span>(<span class="ruby-identifier">x</span>)
|
16
|
+
|
17
|
+
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">x</span> <span class="ruby-operator"><=></span> <span class="ruby-value">0</span>)
|
18
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">s</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span>
|
19
|
+
<span class="ruby-keyword kw">return</span> [<span class="ruby-value">0</span>, <span class="ruby-value">0</span>]
|
20
|
+
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">s</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>)
|
21
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">sqrtb_with_remainder</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">x</span>)
|
22
|
+
<span class="ruby-keyword kw">return</span> [ <span class="ruby-constant">Complex</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>]), <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>]]
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
|
25
|
+
<span class="ruby-identifier">xwords</span> = <span class="ruby-identifier">split_to_words</span>(<span class="ruby-identifier">x</span>, <span class="ruby-value">2</span>)
|
26
|
+
<span class="ruby-identifier">xi</span> = <span class="ruby-identifier">xwords</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
27
|
+
<span class="ruby-identifier">yi</span> = <span class="ruby-value">1</span>
|
28
|
+
|
29
|
+
<span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">xwords</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
30
|
+
<span class="ruby-identifier">xi</span> = (<span class="ruby-identifier">xi</span> <span class="ruby-operator"><<</span> <span class="ruby-value">2</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">xwords</span>[<span class="ruby-identifier">i</span>]
|
31
|
+
<span class="ruby-identifier">d0</span> = (<span class="ruby-identifier">yi</span> <span class="ruby-operator"><<</span> <span class="ruby-value">2</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
32
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">xi</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">d0</span>
|
33
|
+
<span class="ruby-identifier">b</span> = <span class="ruby-value">0</span>
|
34
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">r</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span>
|
35
|
+
<span class="ruby-identifier">b</span> = <span class="ruby-value">1</span>
|
36
|
+
<span class="ruby-identifier">xi</span> = <span class="ruby-identifier">r</span>
|
37
|
+
<span class="ruby-keyword kw">end</span>
|
38
|
+
<span class="ruby-identifier">yi</span> = (<span class="ruby-identifier">yi</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">b</span>
|
39
|
+
<span class="ruby-keyword kw">end</span>
|
40
|
+
<span class="ruby-keyword kw">return</span> [<span class="ruby-identifier">yi</span>, <span class="ruby-identifier">xi</span>]
|
41
|
+
<span class="ruby-keyword kw">end</span></pre>
|
42
|
+
</body>
|
43
|
+
</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>sqrtw (LongMath)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 187</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">LongMath</span>.<span class="ruby-identifier">sqrtw</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">n</span> = <span class="ruby-value">16</span>)
|
15
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">sqrtw_with_remainder</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">n</span>)
|
16
|
+
<span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>]
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,149 @@
|
|
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 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Numeric</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Numeric</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/longdecimal_rb.html">
|
59
|
+
lib/longdecimal.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
<div id="diagram">
|
81
|
+
<map id="map" name="map">
|
82
|
+
<area shape="RECT" coords="251,197,366,245" href="LongDecimalQuot.html" alt="LongDecimalQuot">
|
83
|
+
<area shape="RECT" coords="134,197,227,245" href="LongDecimal.html" alt="LongDecimal">
|
84
|
+
<area shape="RECT" coords="51,5,131,53" href="Comparable.html" alt="Comparable">
|
85
|
+
<area shape="RECT" coords="27,101,155,149" href="LongDecimalRoundingMode/RoundingModeClass.html" alt="RoundingModeClass">
|
86
|
+
<area shape="RECT" coords="239,101,311,149" href="Numeric.html" alt="Numeric">
|
87
|
+
<area shape="RECT" coords="27,187,120,233" href="LongMath.html" alt="LongMath">
|
88
|
+
<area shape="RECT" coords="16,68,192,160" href="LongDecimalRoundingMode.html" alt="LongDecimalRoundingMode">
|
89
|
+
</map>
|
90
|
+
<img src="../dot/f_0.png" usemap="#map" border=0 alt="TopLevel">
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
<div id="method-list">
|
98
|
+
<h3 class="section-bar">Methods</h3>
|
99
|
+
|
100
|
+
<div class="name-list">
|
101
|
+
<a href="#M000111">to_ld</a>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if includes -->
|
109
|
+
|
110
|
+
<div id="section">
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<!-- if method_list -->
|
120
|
+
<div id="methods">
|
121
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
122
|
+
|
123
|
+
<div id="method-M000111" class="method-detail">
|
124
|
+
<a name="M000111"></a>
|
125
|
+
|
126
|
+
<div class="method-heading">
|
127
|
+
<a href="Numeric.src/M000111.html" target="Code" class="method-signature"
|
128
|
+
onclick="popupCode('Numeric.src/M000111.html');return false;">
|
129
|
+
<span class="method-name">to_ld</span><span class="method-args">()</span>
|
130
|
+
</a>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
<div id="validator-badges">
|
145
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
</body>
|
149
|
+
</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>to_ld (Numeric)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/longdecimal.rb, line 1687</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ld</span>
|
15
|
+
<span class="ruby-constant">LongDecimal</span>(<span class="ruby-keyword kw">self</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Sat Mar 04 23:04:52 CET 2006
|
data/doc/dot/f_0.dot
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
digraph TopLevel {
|
2
|
+
compound = true
|
3
|
+
bgcolor = lightcyan1
|
4
|
+
fontname = Arial
|
5
|
+
fontsize = 8
|
6
|
+
label = "lib/longdecimal.rb"
|
7
|
+
node [
|
8
|
+
fontname = Arial,
|
9
|
+
fontsize = 8,
|
10
|
+
color = black
|
11
|
+
]
|
12
|
+
|
13
|
+
subgraph cluster_LongMath {
|
14
|
+
fillcolor = palegreen1
|
15
|
+
URL = "classes/LongMath.html"
|
16
|
+
fontname = Arial
|
17
|
+
color = blue
|
18
|
+
label = "LongMath"
|
19
|
+
style = filled
|
20
|
+
LongMath [
|
21
|
+
shape = plaintext,
|
22
|
+
height = 0.01,
|
23
|
+
width = 0.75,
|
24
|
+
label = ""
|
25
|
+
]
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
LongDecimalRoundingMode -> LongMath [
|
30
|
+
lhead = cluster_LongMath
|
31
|
+
ltail = cluster_LongDecimalRoundingMode
|
32
|
+
]
|
33
|
+
|
34
|
+
Comparable [
|
35
|
+
URL = "classes/Comparable.html",
|
36
|
+
shape = box,
|
37
|
+
label = "Comparable"
|
38
|
+
]
|
39
|
+
|
40
|
+
Comparable -> LongDecimalRoundingMode__RoundingModeClass [
|
41
|
+
|
42
|
+
]
|
43
|
+
|
44
|
+
subgraph cluster_LongDecimalRoundingMode {
|
45
|
+
fillcolor = palegreen1
|
46
|
+
URL = "classes/LongDecimalRoundingMode.html"
|
47
|
+
fontname = Arial
|
48
|
+
color = blue
|
49
|
+
label = "LongDecimalRoundingMode"
|
50
|
+
style = filled
|
51
|
+
LongDecimalRoundingMode [
|
52
|
+
shape = plaintext,
|
53
|
+
height = 0.01,
|
54
|
+
width = 0.01,
|
55
|
+
label = ""
|
56
|
+
]
|
57
|
+
|
58
|
+
LongDecimalRoundingMode__RoundingModeClass [
|
59
|
+
fontcolor = black,
|
60
|
+
URL = "classes/LongDecimalRoundingMode/RoundingModeClass.html",
|
61
|
+
shape = ellipse,
|
62
|
+
color = palegoldenrod,
|
63
|
+
style = filled,
|
64
|
+
label = "RoundingModeClass"
|
65
|
+
]
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
LongDecimalQuot [
|
70
|
+
fontcolor = black,
|
71
|
+
URL = "classes/LongDecimalQuot.html",
|
72
|
+
shape = ellipse,
|
73
|
+
color = palegoldenrod,
|
74
|
+
style = filled,
|
75
|
+
label = "LongDecimalQuot"
|
76
|
+
]
|
77
|
+
|
78
|
+
LongDecimal [
|
79
|
+
fontcolor = black,
|
80
|
+
URL = "classes/LongDecimal.html",
|
81
|
+
shape = ellipse,
|
82
|
+
color = palegoldenrod,
|
83
|
+
style = filled,
|
84
|
+
label = "LongDecimal"
|
85
|
+
]
|
86
|
+
|
87
|
+
Numeric [
|
88
|
+
fontcolor = black,
|
89
|
+
URL = "classes/Numeric.html",
|
90
|
+
shape = ellipse,
|
91
|
+
color = palegoldenrod,
|
92
|
+
style = filled,
|
93
|
+
label = "Numeric"
|
94
|
+
]
|
95
|
+
|
96
|
+
LongDecimalRoundingMode -> LongDecimalQuot [
|
97
|
+
ltail = cluster_LongDecimalRoundingMode
|
98
|
+
]
|
99
|
+
|
100
|
+
Numeric -> LongDecimalQuot [
|
101
|
+
|
102
|
+
]
|
103
|
+
|
104
|
+
LongDecimalRoundingMode -> LongDecimal [
|
105
|
+
ltail = cluster_LongDecimalRoundingMode
|
106
|
+
]
|
107
|
+
|
108
|
+
Numeric -> LongDecimal [
|
109
|
+
|
110
|
+
]
|
111
|
+
|
112
|
+
}
|
113
|
+
|