Get all your news in one place.
100’s of premium titles.
One app.
Start reading
Tom’s Hardware
Tom’s Hardware
Technology
Mark Tyson

Intel's 50-Year-Old 4040 CPU Optimized, Battles ENIAC in Pi-2035 Calculation Race

Intel 4040 SBC.

A tech enthusiast has coaxed his Intel 4040 CPU single board computer into outrunning ENIAC in a race to calculate Pi to 2035 decimal places. Both Pi computation contenders rely upon several decades-old technology, but despite the 30-year advantage held by the Intel 4040, it was a surprisingly tough race. 

The Intel 4040 was fabricated on a 10-micrometer process node and packed in 3,000 transistors. It was designed as a 4-bit processor, running at 740 kHz, and introduced in 1974. Intel’s silicon chip is thus about 30 years younger than the WWII-era Electronic Numerical Integrator and Computer, or ENIAC, famous for being among the first general-purpose computers. In contrast to the tiny Intel 4040, this wartime computer took up 1,500 sq ft of space and included tens of thousands of resistors, vacuum tubes, capacitors, switches, and relays. You can’t put that on an SBC.

(Image credit: Creative Commons)
(Image credit: US Army, Public Domain)

ENIAC calculated Pi to 2035 decimal places in 70 hours when tested back in 1949. ‘Mark Engineer,’ the tech enthusiast behind the project, had previously tried to outrun ENIAC using an SBC equipped with an Intel 4004 (Intel’s first commercial CPU). That attempt wasn’t successful, so he turned his attention to the CPU’s successor, the Intel 4040. On his blog, Mark outlined some of the advances delivered with 1974’s Intel 4040. New features, like the processor’s extended instruction set, gave him hope of success in his ENIAC-trumping quest.

The Intel 4040 SBC (Image credit: Mark Engineer)

The Intel 4040 SBC toting engineer stuck to some self-imposed limits so that the 1974-vintage chip didn’t have any sort of unfair or overly modern advantage against ENIAC. Thus, the little SBC would have to rely on pure computation speed to win, couldn’t use extra I/O ports, and would inherit 1975-era restrictions like that 740 kHz clock speed and 1280 bytes of RAM.

Mark set out these restrictions like any good comparative tester should, and the next section of his lengthy blog mulled over the mathematical algorithm alternatives and choices he was going to make.

(Image credit: Mark Engineer)

First Test Run Took 14.5 Years = Optimization Required

Understandably, for the testing and Pi calculation code refinement stage, Mark used an emulator. That was a good choice as he saw that his maiden voyage of Pi-2035 discovery using the method he had come up with and the virtual 4040 chip was way off target. The tech tinkerer determined that his unoptimized methodology would mean the actual 4040 SBC would need 14.5 years to calculate Pi to the requisite number of decimal places.

Working on the algorithm implementation, the system working memory use, the fixed precision number format, and finding a faster path for big primes were important to speeding up Pi calculation on the Intel 4040. Moreover, working on the early Intel processor’s peculiarities, like how it was much more efficient at addition than subtraction, also paid dividends.

After he was able to pip ENIAC to the post using the 4040 emulator with a calculation time of 69h 29m 02s, Mark was at last comfortable to move over to the real hardware. He provides extensive hardware information, schematics, and information about firmware for those wishing to delve deeper.

Intel 4040 SBC schematic (Image credit: Mark Engineer)

The Pi-2048 calculation on real hardware was very close to what we saw on the emulator. Mark was happy to end his journey with a time of 69h 28m 31s when using the actual Intel 4040 SBC. In case you are wondering, he even explains the modest time discrepancy observed between emulation vs real hardware. Mark says that the difference is likely due to the clock signal generated from stm32 timers, which he said was 740.1kHz on the physical hardware – a very slight overclock...

Calculating Pi-2035 Today is Trivial

Computing Pi to a great degree of accuracy is still a key CPU benchmark in 2023. You can see this benchmarking metric compared and discussed in our latest Intel Core i9-14900K review. Nowadays, multithreading-friendly benchmarking apps like y-cruncher can be used to calculate Pi to trillions of digits.

Modern laptop performance (Image credit: Future)

Out of curiosity, this currently laptop-bound writer decided to calculate Pi to 2035 digits on his old-ish Core i5-8365U laptop. It achieved this feat in around 0.1 seconds. A smartphone Pi calculating app on a mid-range Android phone repeated the 0.1-second feat. 

Sign up to read this article
Read news from 100’s of titles, curated specifically for you.
Already a member? Sign in here
Related Stories
Top stories on inkl right now
One subscription that gives you access to news from hundreds of sites
Already a member? Sign in here
Our Picks
Fourteen days free
Download the app
One app. One membership.
100+ trusted global sources.