Numeric error propagation: Difference between revisions
Content added Content deleted
m (added a ;Related task: (bold) header.) |
m (→{{header|Kotlin}}: Fixed x2-y1-swap, c/f Java/Discussion) |
||
Line 1,138: | Line 1,138: | ||
fun main(args: Array<String>) { |
fun main(args: Array<String>) { |
||
val x1 = Approx(100.0, 1.1) |
val x1 = Approx(100.0, 1.1) |
||
val |
val y1 = Approx(50.0, 1.2) |
||
val |
val x2 = Approx(200.0, 2.2) |
||
val y2 = Approx(100.0, 2.3) |
val y2 = Approx(100.0, 2.3) |
||
println(((x1 - x2).pow(2.0) + (y1 - y2).pow(2.0)).pow(0.5)) // => 111.80339887498948 ±2.938366893361004 |
println(((x1 - x2).pow(2.0) + (y1 - y2).pow(2.0)).pow(0.5)) // => 111.80339887498948 ±2.938366893361004 |
||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre>111.80339887498948 ±2. |
<pre>111.80339887498948 ±2.4871670631463423</pre> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |