uncertaintyRangeForQuantity function
Creates a QuantityRange that represents the standard uncertainty of q
.
Implementation
QuantityRange<Quantity> uncertaintyRangeForQuantity(Quantity q, {double k = 1.0}) {
final std = q.standardUncertainty;
if (k == 1.0) {
return QuantityRange<Quantity>(q - std, q + std);
} else {
final expanded = q.calcExpandedUncertainty(k);
return QuantityRange<Quantity>(q - expanded, q + expanded);
}
}