In reply to Jean-Christophe Lemarié.

Thanks for pointing out this issue. I think the correct adjustment is to switch the lower and upper bounds in those cases:

if CI_b[1] > CI_b[2] then CI_b = CI_b[2] || CI_b[1]; /* ensure interval is [L,U] where L CI_a[2] then CI_a = CI_a[2] || CI_a[1]; /* ensure interval is [L,U] where L