Even if we assume that the smallest container contains 0.0001 gallon
we can still measure exactly 4 gallons.
S = 0.0001
M = S+2 = 2.0001
B = M+2 = 4.0001 gallons
1. First fill the container M completely.
2. The pour water from this container to the smallest container
Here you have exactly 2 gallons left in the M container.
3. Now pour this water onto container B. It now contains 2 gallons
4. Now pour back the water from S to M. Now M contains 0.0001 Gallons
5. Fill the M container with more water. Now M contains 2.0001 gallons
6. Pour water from M to S and now M contains exactly 2 gallons.
7. Now pour water from M to B. Now B contains 4 gallons.