Binary Coded Decimal (BCD) & Douglas Adams' 42 - Computerphile

Share this video on

What's Hot

What's New

Top Grossing

Top of the Chart

Recommend

ProfDaveB : Yes, I just wanted to show that "Computerphile" presenters other than Dr Bagley are also allowed to wear Hawaiian shirts! This particular one was bought about 8 years ago at Macy's, in Stanford University's Shopping Mall.

RUSKiE : The ASCII equivalent of 42 is asterisk. The asterisk is used in computing to represent 'anything'. So the answer to life, the universe and everything is anything ;)

Brendan McCabe : There are 10 types of people in the world 1. those who understand binary 2. those who don’t 3. those who didn’t expect this joke to be base 3

Xilefian : I was programming some stuff with binary coded decimal the other day. It's still used for real-time clock chips! If you want the bare-metal low level time from these chips they give you BCD, presumably because it's easier to print BCD out to cheap digital displays than to convert an integer to a string. EDIT: Yep you mentioned digital clocks at the end of the video! Very excellent.

LMacNeill : The fact that there is no exact representation of 0.10 in binary has actually killed people. No joke. In the first Gulf War (1990-91) the Patriot missile system was used to shoot down Soviet-made Iraqi Scud missiles. These missile systems clearly had to have very precise clocks in order to know exactly how fast their targets were moving, so that they could know where the target would be by the time the Patriot missile arrived, so it would be in the immediate vicinity of the target when it exploded -- thereby destroying the target in the process. But the initial release of the software in the Patriot missile system had a flaw. Because 0.10 cannot be represented precisely in binary, it's clock would get off by a tiny bit every tenth of a second. If you rebooted the system every 8 to 12 hours, it was never enough of an error to make a big difference. But one particular Patriot installation, protecting a U.S. military barracks in Saudi Arabia hadn't been rebooted in several days, when Iraq fired a Scud missile at it. The Patriot system didn't even fire its missiles because its internal clock was so far off that it simply lost track of the incoming Scud. 28 American soldiers were killed and approximately 100 more were injured, simply because 0.10 cannot be represented in binary, and the programmers didn't realize how big a deal a tiny fraction of a second would be, when added up over many thousands of seconds. :-(

TheTwick : Professor Brailsford, NEVER STOP telling us stories about computers and computing. I could listen all day.

Giles Bathgate : If only they had continued and made 4bits = nibble, 8bits = byte, 16bit= munch, 32bit = gobble, 64bit = meal.

Slithereenn : "Heavyweight macho calculations". I love it.

Vyl Bird : The exact wording is important. The Deep Thought was specifically asked "What is the answer to the ultimate question of life, the universe and everything?" The answer it eventually gave was 42. It was not, however, able to compute the ultimate question itsself, to which 42 was the answer.

AngryMurloc : 42 || !42 - William Shakespeare

RMoribayashi : HP scientific calculators all used BCD so avoided the rounding problems inherent in a true binary calculator. In 2004 Thomas Okken's released his exellent HP-42 simulator, Free42. It comes in both BCD and the slightly faster floating point binary versions. SwissMicros brought it full circle in 2017 when they released the DM-42, a physical calculator based on the HP-42 but using a modified version of Free42 for it's firmware. And yes... it uses BCD.

Isabella Bihy : I decided to learn how to tame computers fairly early in life. No, not the cute ones, the desk top computers, which used to be called the "toy department" where I worked. I fell in love with the huge machines at the age of thirteen. By then, there were card punches and card hoppers and a chain printer that sounded like a couple of machine guns going off at the same time. When I went to college in the late 1970ies there were all of those wonderful things, punches, hoppers and this printer. I was happy. Even when I dropped a deck of cards with program code on it. Of course I had spared myself having to punch line numbers. I have experienced the big changes in main frame architecture, from 16bit to 32bit, terminals instead of card decks, the looming software desaster of Y2K, the change from 32bit to 64bit, well, the details passed me. In my early years at work I learned to read machine code, which is helpful analysing bugs, and to program temporary fixes in machine code. It is so nice to see and hear someone explaining the origins of computing. There are still a few dinosaurs of the computer age around, but they are threatened by extinction. Shortly before I went into early retirement, I worked on a client project where one of the required skills was "main frame", programming languages and other software.

John Francis Doe : Your quote of the dialogue was incomplete. The sentence uttered by deep thought before the answer was slightly longer. But the recipients of the output didn't know what the question was, so they commissioned the building of planet Earth to compute the corresponding question.

De naaits : Why weren't my teachers more like this guy?! Hats off to the knowledge and experience.

Penny Lane : Decimal floating point next?

avi12 : 4:52 "Because... the average person wants their answers out in decimal, not hexadecimal" Like!

Mister Hat : Why not use an integer number of cents to represent money? Then there's no problem with incorrect rounding.

tabaks : An episode on FUNDAMENTAL differences between AI and classical programming would be GRAND! Basically, for the lay person, why AI isn't just a giga-complex classical programming effort that is pre-loaded with all possible outcomes...

Zacharie Etienne : There are 10 types of people in the world 1. those who understand binary 2. those who don’t 3. those who didn’t expect this joke to be base 3

BOOZE & METAL : 6502 cpu has a bcd mode , you can turn it off and on and it doesn't take any extra time. I never knew what could it be used for but now it makes sence. Funny thing that nothing stops you from putting numbers that have digits higher than 9 (0xAF for example) and the result of math operations on such numbers is interesting

Eric ON : Deep thought wasn't earth. The earth was made as another computer to answer the question for real.

Reji Domus : These stories are pure gold.

CyanGaming | ᴹᶦᶰᵉᶜʳᵃᶠᵗ ⁻ ᴳᵃᵐᵉᴾᶫᵃʸ : BCD makes multi-digit 7 segment displays easier :D

Aokis : Hehe 42 comments

Patrick from Vienna : I don't get it. What is the need for prepending 4 bit before printing?

Tom Mulligan : I fancy a nybble

EscapeMCP : Speak up. I can't hear you over that shirt. :)

Menachem Salomon : How efficient is multiplication with BCD? I ask because the Intel x86 line allows for BCD addition and subtraction, with "adjustments" and a flag to handle the overflow into the 0xA-0xF space. But for multiplication and division, the operands have to be converted to binary first, and the result back into BCD afterwards. (The FPU can load and store BCD, but internally arithmetic is done in binary.) Is it just the manual method performed in hardware?

Tony Colle : I love these journeys into history. It's actually very important to have some knowledge of these topics so people who want to be Computer Scientists and not just programmers (although there is nothing wrong with the profession) know how we got to where we are and where we might be heading in the future. Is there some chance that Professor Brailsford or someone can do a session on packed decimal? That is the technology on which so much of the financial world was built and still lives today.

Olaf Doschke : Did I already mention this in another video? Motorola's 68000 CPU had the assembler instruction ABCD - Add Binary Coded Decimal.

Robert Zanatta : Some microprocessors had rudimentary BCD opcodes, such as the Intel X86.

Jan Sten Adámek : Fun fact: all x86 processors have instructions for BCD and they have one-byte opcodes because someone though that they would be used very often.

K van der Veen : I expected at least a mentioning of the double dabble algorithm.

Antonio Rocha : Thank you sir. I always appreciate your brilliant way to express your vast knowledge.

# : Answer to the Ultimate Question of Life, the Universe, and Everything !

TrivleX : waddup my nibbles

Confused Wolf : whoa!! excellent sunny shirt!!

Kyle W : Earliest comment yet! also that shirt!!

greatgamer34 : I built a BCD in -> Binary Out (16bit) in Minecraft hahaha. Its as small as it can be.

pcuser80 : The Z80 had a special instruction for convert the A register to BCD. DAA (Decimal Adjust accumulator)

information to learn : Interesting!😎 Saving the video in the computer and network file.

Suvi-Tuuli Allan : I am a robot.

Creative & Random : deep thot

Young thug : I can't understand anything but I love his voice

Tyler The God : Ok

Jim Griffiths : *

superscatboy : When I was young and naive, I wanted to work with huge integers in QBasic (to calculate large Lucas numbers) and inadvertently reinvented a highly inefficient BCD system. It was ugly and slow, but it worked goddammit. Still one of my proudest moments in a strange way. I still have a printout of a 20000 digit Lucas number I generated with that nasty bit of work.

Sam Gu3 : also 42 on the ascii table is '*' which is used (among other things) to reference everything therefore, the answer to the universe and everything . . . is everything want a new universe with a new answer? just find the root directory of the universe and execute "cp * version2.universe". alternatively if you don't like the answer, delete it. i'm sure nothing bad will happen when "rm *" is run on the root of the universe

LoneTech : For comparison, there's also FIO-DEC that didn't quite make it this easy (1-9 were precisely those values, but the digit 0 was code 20 octal, or 10000 binary). Decimal types nowadays frequently use word cutoffs rather than digit cutoffs, which can fit e.g. 9 digits in 32 bits or 19 digits in 64 bits.

Frixy G : I'm wondering why his go-to example of where you might find a digital clock is a shopping mall. Is it a UK cultural thing? Are malls there known for having digital clocks on the wall or something? (Not trying to poke fun here; genuinely curious.) In any case, another great video from my favorite Computerphile presenter.