Numeric error propagation: Difference between revisions
Content added Content deleted
mNo edit summary |
|||
Line 1,475: | Line 1,475: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
=== Using |
=== Using Measurements library === |
||
<lang julia> |
<lang julia> |
||
using Measurements |
using Measurements |
||
Line 1,489: | Line 1,489: | ||
@show d.val, d.err |
@show d.val, d.err |
||
</lang>{{out}} |
</lang>{{out}} |
||
The |
The Measurements library will round to correct decimal place precision when displaying tolerances, so the fields are shown to show the calculations are equivalent. |
||
<pre> |
<pre> |
||
d = 111.8 ± 2.5 |
d = 111.8 ± 2.5 |
||
(d.val, d.err) = (111.80339887498948, 2.4871670631463423) |
(d.val, d.err) = (111.80339887498948, 2.4871670631463423) |
||
</pre> |
</pre> |
||
=== With custom module === |
=== With custom module === |
||
<lang julia>module NumericError |
<lang julia>module NumericError |