Kahan summation: Difference between revisions
→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)"
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
||
Line 2,548:
Kahan sum = 1</pre>
=={{header|V (Vlang)}}==
{{trans|go}}
Vlang has no floating point decimal type. Its floating point types are f64 and f32, implementations of IEEE 754 binary64 and binary32 formats. Alternative task:
<syntaxhighlight lang="v (vlang)">fn kahan(s ...f64) f64 {
mut tot, mut c := 0.0, 0.0
for x in s {
|