The share of each of two components that hits a target.
V_a = total × (target − b) / (a − b) V_b = total − V_a
When it returns null
A target outside the two values. Blending can't go past either component,
so two lots at 11 % and 13 % can't make 14 % in any proportion. The formula
itself doesn't catch this (it returns a share above one and a negative
volume for the other), so we check here instead of leaving the caller to
spot a negative litre.
Two components with the same value. a − b is zero and every proportion
is equally right, so there's no answer to "how much of each". A blend of two
identical lots is whatever the blender likes.
Both cases return null, so a caller that shows a result has to decide
what to say in place of a meaningless number.
The share of each of two components that hits a target.
When it returns null
A target outside the two values. Blending can't go past either component, so two lots at 11 % and 13 % can't make 14 % in any proportion. The formula itself doesn't catch this (it returns a share above one and a negative volume for the other), so we check here instead of leaving the caller to spot a negative litre.
Two components with the same value.
a − bis zero and every proportion is equally right, so there's no answer to "how much of each". A blend of two identical lots is whatever the blender likes.Both cases return
null, so a caller that shows a result has to decide what to say in place of a meaningless number.