Kahan summation: Difference between revisions

m
→‎{{header|REXX}}: added "version"s to various output sections.
m (→‎{{header|REXX}}: added "version"s to various output sections.)
Line 1,762:
Kahan summation of a,b,c = 1.00000000000000000000000000000
</pre>
{{out|output|text=&nbsp; using Regina version 3.3 and earlier:}}
<pre>
decimal digits = 6
Line 1,779:
simple summation of a,b,c = 0.999999999999999999999999999997
Kahan summation of a,b,c = 1.00000000000000000000000000000</pre>
{{out|output|text=&nbsp; using Regina version 3.4 and later &nbsp; (latest at this time is version 3.9.1):}}
<pre>decimal digits = 6
a = 10000.0
Line 1,797:
 
===tweaked version===
The following tweaked REXX version causes Regina (version 3.4 and later) to work properly.
<lang rexx>/*REXX program demonstrates simple addition versus using Kahan summation algorithm. */
numeric digits 6 /*use six decimal digits for precision.*/
Line 1,829:
say 'Kahan summation of a,b,c = ' kahan(a,b,c) /*sum via Kahan summation. */
return</lang>
{{out|output|text=&nbsp; using Regina version 3.4 and also for later versions:}}
<pre>decimal digits = 6
a = 10000.0
Line 1,845:
simple summation of a,b,c = 1.0000000000000000000000000000001
Kahan summation of a,b,c = 1.0000000000000000000000000000000</pre>
 
'''output''' for ooRexx:
<pre>decimal digits = 6
Line 1,863 ⟶ 1,864:
 
ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª</pre>
 
=={{header|Scala}}==
===IEEE 754 Single precision 32-bit (JavaScript defaults to Double precision.)===