The following example draws two boxes. The first box is just one box drawn with a globalAlpha of 1. The second box is the sum of 2 boxes with globalAlpha of 0.5.
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
ctx.fillStyle = "blue";
ctx.globalAlpha = 1.0;
ctx.fillRect(0, 0, 100, 100);
ctx.globalAlpha = 0.5;
ctx.fillRect(100, 0, 100, 100);
ctx.fillRect(100, 0, 100, 100);
<canvas id="canvas"></canvas>
It seems to me that the two alpha values of 0.5 do not sum to 1, because the boxes do not have the same color. This is how it looks on my screen.
How to bisect an alpha correctly?

This seems to work somehow, but I am not sure if I can rely on 2.2.
The error is visible for 100 iterations.