Following its release of record third-quarter 2018 earnings on Tuesday, Apple today became the first U.S. company to hit a $1 trillion market capitalization — a profound achievement for a company that was days away from bankruptcy only 21 years ago. Apple’s stock approached the milestone months ago, leading some to ask whether rival Amazon might surpass it, but a two-day rally after earnings pushed the Cupertino company over the top.

Notwithstanding suggestions that it has become predictable, Apple’s record valuation reflects growing market optimism about the company’s future prospects. The company reported continued strong sales of its flagship iPhones — responsible for roughly 60 percent of its revenues — and marked growth in its wearables and services divisions. Notably, the average selling price of an iPhone rose this quarter to a staggering $724, and iPhone sales have remained stable despite contractions in the broader smartphone market.

According to Apple CEO Tim Cook and CFO Luca Maestri, even the company’s comparatively small wearables division has become a $10 billion annual business for the company, thanks to relatively recent innovations including the Apple Watch and AirPods earphones. Simultaneously, services such as the App Store, iCloud, Apple Music, and AppleCare are now contributing nearly $10 billion in revenue per quarter. Cook and Maestri said that they expect the same three divisions to show continued strong performance over the next quarter.

In recent years, Apple’s quarterly profit forecasts have been consistently accurate while continuing to set records. Apple now generates around $50 billion in revenue per quarter, in part by maintaining an industry-leading 38 percent profit margin across its offerings. It spends billions of those dollars each quarter on new facilities and technologies, as well as on returning cash to shareholders.

According to the NASDAQ exchange, Apple reached the $1,000,000,000,000 mark at 11:48 or 11:49 a.m. Eastern Time today by hitting a share price of $207.05 across over 4.8 billion outstanding shares, floating up and down around the milestone throughout the trading session. Several publications inaccurately reported that it had hit the $1 trillion mark earlier by reaching a share price in the $203 range, illustrating two challenges in determining Apple’s actual market capitalization.

First, the company has been aggressively buying back blocks of its own stock, cutting the number of outstanding shares by amounts that aren’t necessarily public. On Wednesday afternoon, Apple updated its 10-Q to reflect 4,829,926,000 outstanding shares as of July 20, 2018, providing the most accurate known number. But since Apple’s own Stocks app was using old data from third-party data provider Yahoo, it miscalculated the figure and showed an over $1 trillion valuation earlier in the trading day. Yahoo later updated its data.

Above: After briefly touching the $207.05 mark just before noon, Apple’s stock hit $208.38 per share later in Thursday’s trading session, settling at $207.39 for the day.

Image Credit: Jeremy Horwitz/VentureBeat

Second, stock prices fluctuate throughout the day, and the final share price for the day is computed using a complex “closing cross” system, which is somewhere between the day’s highs and lows. Apple’s initial trillion-dollar valuation came from hitting $207.05, but reached a mid-day high of $208.38 per share before settling at $207.39 at the close of trading.

As a result of these ambiguities, multiplying the current share price by the most recently divulged number of outstanding shares yields only a close estimate, assuming that being around $10 billion off can be considered “close” at this scale. At the end of Thursday’s trading, Yahoo officially listed Apple’s market cap as $1.002 trillion.

It’s worth a brief note that the first publicly traded company to hit $1 trillion in valuation was Chinese company PetroChina, which surged to that level on its first day of Shanghai market trading in November 2007, but subsequently dropped. PetroChina — an arm of China’s state-owned national petroleum company — is now valued at around $210 billion.

Concerns about the potential impact of an ongoing trade war between China and the United States have cast a cloud on Apple, which relies substantially on Chinese facilities to manufacture its products. Apple CEO Cook downplayed the risks on Tuesday, stating that he believes mutually beneficial trade is in both countries’ interests — and the world’s — and hopes that cooler heads will prevail.