The calculation is set by ASC 260, Earnings Per Share, and the figure is tagged in XBRL as WeightedAverageNumberOfSharesOutstandingBasic. Regulation S-X Rule 5-03.25 calls for earnings per share data on the face of the income statement, and the share counts behind it are disclosed with it. Companies whose basic and diluted counts are identical, often because they have no dilutive securities or reported a loss, may tag a single value as WeightedAverageNumberOfShareOutstandingBasicAndDiluted.
The basic count includes only shares actually outstanding. Stock options, warrants, unvested restricted stock, and convertible securities are left out until they turn into shares, although shares issuable for little or no further consideration are included once all conditions are met. Stock splits and stock dividends are handled differently from issuances: they are applied retroactively to every period presented, so a two-for-one split doubles the share count for prior years as well and keeps per-share history comparable.
Because it is an average, this number usually differs from the shares outstanding shown on the cover of a 10-K or 10-Q, which is a count on a single date. For valuation work such as market capitalization, analysts use the most recent point-in-time count. For per-share earnings over a period, the weighted average is the right match, because income was earned across the whole period.