Switeck wrote:It is "deceptive" because the price range seems like an even distribution between the largest and smallest values when it's anything but.
Thank you, 'deceptive' is the word I was looking for.
The overflow is not a bug, but a feature. It's simply a part of the calculation formula. The final '& 256' ensures that only the first eight bits (= range between 0 and 255) go into the final price, all higher bits are ignored. As a result the value flips over: 256 becomes 0, 257 becomes 1, 258 becomes 2, and so on.
After the calculation the result is multiplied with 0.4 in order to get the actual price. This determines the total price range: 0 * 0.4 = 0; ... 255 * 0.4 = 102. No prices lower than 0 or higher than 102 can ever be in the game. Again, higher prices 'flip over': 256 becomes 0, 0 * 0.4 = 0; 257 becomes 1, 1 * 0.4 = 0.4. And so on. (Apologies if this is only a repetition of well-known facts.)
Now look at the Narcotics prices in the various economies. From 'average industrial' up to 'rich agricultural' they are not affected by the overflow, they don't flip over. They follow an easily to see pattern: the difference between the lowest and highest is exactly 48, and for each higher economy both highest and lowest are 11.6 above the previous economy: AvInd low = 3.2, high = 51.2 (difference 48); PoorInd low = 3.2 + 11.6 = 14.8, high = 51.2 + 11.6 = 62.8; MainInd low = 14.8 + 11.6 = 26.4, high = 62.8 + 11.6 = 74.4; and so on. Now what about rich industrial? According to the formula just established we can take the low and high value of the average industrial and
subtract 11.6. This gives us 3.2 - 11.6 = -8.4 and 51.2 - 11.6 = 39.6. Thus, -8.4 and 39.6 are the actual lowest and highest prices for narcotics in rich industrials. But there are no negative prices. The price flips just like a price higher than 102 would flip, only in the opposite direction. What leaves at the upper border of the range re-enters at the lower border. And what leaves at the lower border of the range re-enters at the upper border. The price of -8.4 becomes 102 - 8.4 = 93.6. Therefore the
real price range for Narcotics in rich industrials is from 93.6 to 102, and from 0 to 39.6. Because prices grow in fixed steps (in this case in steps of 2.8 ), neither the 102 nor the 0 are actually hit, but 100.4 and 1.2 are the steps closest to the flipping point. If you just look at the two numbers in the calculator you could assume that prices are somehow evenly distributed between 1.2 and 100.4, but you would be wrong. In reality there are a couple of possible prices between 1.2 and 39.6, and another couple of possible prices between 93.6 and 100.4, but you will never find a price between 39.6 and 93.6.
The same goes for the last two economies. The actual price range in average agriculturals is 49.6 + 11.6 = 61.2 as low price and 97.6 + 11.6 = 109.2 as high price. Again, everything above 102 flips over and therefore you get an effective range from 61.2 to 102 and from 0 to 7.2, with nothing between 7.2 and 61.2.
Finally, in poor agriculturals the low price is 61.2 + 11.6 = 72.8 and the high price is 109.2 + 11.6 = 120.8. Again, the 120.8 flips over and you get an effective range from 72.8 to 102 and from 0 to 18.8, with nothing between 18.8 and 72.8.
In order to get a feeling for which prices are actually met in the game and which are not, I think it's important to know the true price range for each economy without the flipover (or overflow). The numbers that happen to be the lowest and highest after the flipover (like 1.2 and 100.4 in case of RichInd) don't convey this information. That's why they are (or at least can be) deceptive (thanks again, Switeck, for giving me the right word).