Numeric error propagation: Difference between revisions

m
added whitespace to the task's preamble (in the √ formula).
m (added whitespace and highlighting to the task's preamble.)
m (added whitespace to the task's preamble (in the √ formula).)
Line 23:
;Task details:
# Add an uncertain number type to your language that can support addition, subtraction, multiplication, division, and exponentiation between numbers with an associated error term together with 'normal' floating point numbers without an associated error term. <br>Implement enough functionality to perform the following calculations.
# Given coordinates and their errors:<br>x1 = 100 &plusmn; 1.1<br>y1 = 50 &plusmn; 1.2<br>x2 = 200 &plusmn; 2.2<br>y2 = 100 &plusmn; 2.3<br> if point p1 is located at (x1, y1) and p2 is at (x2, y2); calculate the distance between the two points using the classic Pythagorean formula: <br> <big><big> d = &radic;<span style="text-decoration:overline"> &nbsp; (x1 - x2)² &nbsp; + &nbsp; (y1 - y2)² &nbsp; </span> </big></big>
# Print and display both &nbsp; <big> '''d''' </big> &nbsp; and its error.