about summary refs log tree commit diff stats
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/022arithmetic.cc.html14
-rw-r--r--html/070table.mu.html4
2 files changed, 9 insertions, 9 deletions
diff --git a/html/022arithmetic.cc.html b/html/022arithmetic.cc.html
index 7a0e24b9..4d2b454e 100644
--- a/html/022arithmetic.cc.html
+++ b/html/022arithmetic.cc.html
@@ -305,8 +305,9 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span
 <span class="Delimiter">:(before &quot;End Primitive Recipe Implementations&quot;)</span>
 <span class="Normal">case</span> DIVIDE_WITH_REMAINDER: <span class="Delimiter">{</span>
   products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span>
-  <span class="Normal">int</span> a = <span class="Normal">static_cast</span>&lt;<span class="Normal">int</span>&gt;<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span>
-  <span class="Normal">int</span> b = <span class="Normal">static_cast</span>&lt;<span class="Normal">int</span>&gt;<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span>
+  <span class="Comment">// fractions will be dropped; very large numbers will overflow</span>
+  <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> a = <span class="Normal">static_cast</span>&lt;<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>&gt;<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span>
+  <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> b = <span class="Normal">static_cast</span>&lt;<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>&gt;<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span>
   <span class="Normal">if</span> <span class="Delimiter">(</span>b == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
     raise &lt;&lt; maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> &lt;&lt; <span class="Constant">&quot;divide by zero in '&quot;</span> &lt;&lt; to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> &lt;&lt; <span class="Constant">&quot;'</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
     products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span>
@@ -314,11 +315,10 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span
     products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span>
     <span class="Identifier">break</span><span class="Delimiter">;</span>
   <span class="Delimiter">}</span>
-  <span class="Normal">int</span> quotient = a / b<span class="Delimiter">;</span>
-  <span class="Normal">int</span> remainder = a % b<span class="Delimiter">;</span>
-  <span class="Comment">// very large integers will lose precision</span>
-  products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>quotient<span class="Delimiter">);</span>
-  products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>remainder<span class="Delimiter">);</span>
+  <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> quotient = a / b<span class="Delimiter">;</span>
+  <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> remainder = a % b<span class="Delimiter">;</span>
+  products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Normal">static_cast</span>&lt;<span class="Normal">double</span>&gt;<span class="Delimiter">(</span>quotient<span class="Delimiter">));</span>
+  products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Normal">static_cast</span>&lt;<span class="Normal">double</span>&gt;<span class="Delimiter">(</span>remainder<span class="Delimiter">));</span>
   <span class="Identifier">break</span><span class="Delimiter">;</span>
 <span class="Delimiter">}</span>
 
diff --git a/html/070table.mu.html b/html/070table.mu.html
index 7d46ec53..b843f50f 100644
--- a/html/070table.mu.html
+++ b/html/070table.mu.html
@@ -86,7 +86,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   hash <span class="Special">&lt;-</span> abs hash
   capacity:num <span class="Special">&lt;-</span> get *table, <span class="Constant">capacity:offset</span>
   _, hash-key:num <span class="Special">&lt;-</span> divide-with-remainder hash, capacity
-  hash-key <span class="Special">&lt;-</span> abs hash-key  <span class="Comment"># in case hash-key overflows into a negative integer</span>
+  hash-key <span class="Special">&lt;-</span> abs hash-key  <span class="Comment"># in case hash overflows from a double into a negative integer inside 'divide-with-remainder' above</span>
   table-data:&amp;:@:table-row:_key:_value <span class="Special">&lt;-</span> get *table, <span class="Constant">data:offset</span>
   x:table-row:_key:_value <span class="Special">&lt;-</span> index *table-data, hash-key
   occupied?:bool <span class="Special">&lt;-</span> get x, <span class="Constant">occupied?:offset</span>
@@ -103,7 +103,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   hash <span class="Special">&lt;-</span> abs hash
   capacity:num <span class="Special">&lt;-</span> get *table, <span class="Constant">capacity:offset</span>
   _, hash-key:num <span class="Special">&lt;-</span> divide-with-remainder hash, capacity
-  hash-key <span class="Special">&lt;-</span> abs hash-key  <span class="Comment"># in case hash-key overflows into a negative integer</span>
+  hash-key <span class="Special">&lt;-</span> abs hash-key  <span class="Comment"># in case hash overflows from a double into a negative integer inside 'divide-with-remainder' above</span>
   table-data:&amp;:@:table-row:_key:_value <span class="Special">&lt;-</span> get *table, <span class="Constant">data:offset</span>
   x:table-row:_key:_value <span class="Special">&lt;-</span> index *table-data, hash-key
   occupied?:bool <span class="Special">&lt;-</span> get x, <span class="Constant">occupied?:offset</span>