The actual code is (which is what matters):
The "actual code" is only useful to those that can actually read code (in which case they could have looked it up themselves). If they are asking "What mathematical analysis proves that BTC created by 2009 with a fixed supply of 21million", there's a pretty good chance that they want a description of what's happening and not a copy of the code.
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
// Force block reward to zero when right shift is undefined.
if (halvings >= 64)
return 0;
CAmount nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
nSubsidy >>= halvings;
return nSubsidy;
}
So at the 64th halving or approx 64x4 years (256 years) the base reward is set to zero.
While you recognized that CAmount is a 64 bit integer, you overlooked the fact that:
typedef int64_t CAmount;
static const CAmount COIN = 100000000;
Therefore, nSubsidy = 50 * COIN = 5,000,000,000
5,000,000,000 in binary is 00000000 00000000 00000000 00000001 00101010 00000101 11110010 00000000
You may notice that the first 31 digits are zero?
Therefore, at the 64 - 31 = 33rd halving or approximately 33 x 4 years = 132 years the base reward is set to zero.
We are already 12.5 years in, so about 119.5 more years.
You do address this later, but at that time you appear to forget that nSubsidy is an integer and seem to imply that it is a decimal value of some sort.
nSubsidy >>= halvings;
hits less than 1 satoshi when halvings is 33
It doesn't hit "less than 1 satoshi". It hits 0. Exactly 0. No more, no less.
However, if core decides to extend the places to 16 at some time before that, then the 58th halving (59th row) will be zero.
Places? Satoshis are integers. There are no places. Rather significant changes would need to be made to the consensus code to use values smaller than a satoshi for on-chain transactions. I'm not certain that it could be accomplished without a hard fork.