Knowledge Dump

measuring_error (C++17)

A very basic class for numeric values with measuring error. It only supports summation and multiplication for values under certain conditions, such as independent and homoscedastic measuring errors – hence, the actual use of the class in this state is very limited, with lots of room for improvement.
Assuming two values $x_1,x_2$ with absolute measuring errors $\epsilon_1,\epsilon_2$, the measuring error of the sum ($\epsilon_s$) and the product ($\epsilon_p$) can be approximated with the formulas $$\epsilon_s=\sqrt{\epsilon_1^2+\epsilon_2^2}$$ and $$\epsilon_p=\left(x_1\cdot x_2\right)\sqrt{\left(\frac{\epsilon_1}{x_1}\right)^2+\left(\frac{\epsilon_2}{x_2}\right)^2}.$$ The value $\epsilon_1/x_1$ is also called relative measuring error.
Note that the formulas remain the same for subtraction and division. Download(zip).