The oil viscosity scale is not linear
It's been many years since I studied that subject, but I believe that if you mix equal parts 30 and 50 weight, you get something like 37, not 40. On the other hand, the system for designating the viscosity also has rather broad borders, so some of the cheaper stuff being marketed as 40 is probably 37 and the next cheap bottle might be 43.
To put it another way (the way I first encountered the issue), if you have a case of 50 weight and a case of 30 weight, and you want to put 40 weight in your engine, you should use two 50 weight to each 30 weight.
Complicating the matter further, if you try to mix different brands, is the problem that some viscosity improvers complement one another better than others, so you can't always expect the high temperature number to come out in direct proportion to the low temperature numbers when you mix different viscosities of different brands of multigrades. Really, though, these ranges are flexible enough that it shouldn't create a problem in any case.