Generalised floating point addition: Difference between revisions

m
→‎base 10 only: change the E in the exponent to be lowercase to match the task narrative. -- ~~~~
m (→‎base 10 only: added comment about LINESIZE bif. -- ~~~~)
m (→‎base 10 only: change the E in the exponent to be lowercase to match the task narrative. -- ~~~~)
Line 637:
 
sum=(sum+addend.k)/1 /*a way to elide trailing zeroes.*/
say right(k,3) 'sum_='format(sum,,,,0) /*thisforce forcessum exponentional──►exponentional fmt.*/
say right(k,3) 'sum='translate(_,"e",'E') /*lets lowercase the E. */
end /*k*/</lang>
 
exit /*stick a fork in it, we're done.*/</lang>
'''output'''
<pre style="overflow:scroll">
Line 673 ⟶ 676:
21 1e-189 [266 digits]
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
-7 sum=1E1e+72
-6 sum=1E1e+72
-5 sum=1E1e+72
-4 sum=1E1e+72
-3 sum=1E1e+72
-2 sum=1E1e+72
-1 sum=1E1e+72
0 sum=1E1e+72
1 sum=1E1e+72
2 sum=1E1e+72
3 sum=1E1e+72
4 sum=1E1e+72
5 sum=1E1e+72
6 sum=1E1e+72
7 sum=1E1e+72
8 sum=1E1e+72
9 sum=1E1e+72
10 sum=1E1e+72
11 sum=1E1e+72
12 sum=1E1e+72
13 sum=1E1e+72
14 sum=1E1e+72
15 sum=1E1e+72
16 sum=1E1e+72
17 sum=1E1e+72
18 sum=1E1e+72
19 sum=1E1e+72
20 sum=1E1e+72
21 sum=1E1e+72
</pre>