Kahan summation: Difference between revisions

→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details
m (→‎vanilla version: fixed a cut and paste mishap.)
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
Line 921:
=={{header|Kotlin}}==
Kotlin does not have a 6 digit decimal type. The closest we have to it is the 4-byte floating point type, Float, which has a precision of 6 to 9 significant decimal digits - about 7 on average. So performing the alternative task:
<lang scala>// version 1.1.12
 
fun kahanSum(vararg fa: Float): Float {
Line 947:
println("Epsilon = $b")
println("(a + b) + c = ${(a + b) + c}")
println("Kahan sum = ${kahanSum(a, b, c)}")
}</lang>