Decimal computation: when CPUs do not compute in binary

when CPUs do not compute in binary

We associate the base 2 or binary code with the computers that we use daily by treating these with digital and non-analog signals, however in the history of computing there have been processors with the ability to operate with base 10 numbers as we do. Natural way. What is decimal computing used for and what are the characteristics of this type of processor?

Decimal computing consists of processors with the ability to operate figures in base 10, and therefore in which their values are stored in signifiers ranging from 0 to 9 instead of from 0 to 1. Despite the fact that the representation system Binary is good enough for the chores of everyday life, this is not always the case and there are applications where it is necessary for a processor to be able to operate in base 10.

Why is decimal computation necessary?

Computación financiera decimal

In the case of decimal computing, the same is true as with scientific computing where 64-bit floating point units are required, since less use can give inaccurate results with catastrophic consequences both economically and in the field of experimentation.

In the field of hardware, the more complex a representation is in terms of numbers of transistors to represent it, it is also complex to operate with it. That is why when we speak of a specific precision system, more precise numerical representation systems are used in computers when representing and operating said values in order to have the necessary precision.

Servicios finncieros computación decimal

Well, there are a series of applications, especially related to finance, e-commerce and some web services that process data that require the precision of a unit that is capable of working directly with decimal values, either in floating point or in integers. And you may have guessed that due to the markets for these same applications we are talking about very specific sectors that use CPUs for servers.

What are the limitations of the binary system? If we take the conventional binary floating point system we will see that for example if we want to represent something as simple as 0.1 in binary we will need a recurring binary fraction that tends to infinity. On the other hand, if we do it with a decimal system, we can represent it as a simple fraction of 1/10. Think for a moment what would happen in the financial market if due to lack of precision the numbers do not add up.

Binary and decimal on the same CPU

CPU Render

Pure decimal computing does not occur in processors today, not even at the server scale. This is because the base in which a computer operates defines very well the way in which not only its execution units process data, but also how instructions are decoded and how the system’s RAM memory is accessed. In other words, we would be facing a completely different system and whose code would not be compatible at all.

That is why by standard the following rules have been assigned to combine the power to work in binary and decimal:

  • The encoding of the instructions is always done in binary
  • The data is stored in binary or decimal as required.
  • Each data type in base or type, floating point or integer, is operated by a different type of unit.
  • The memory addressing is always done in binary, to avoid access conflicts and that the CPU has to work with two different spaces.

This is done in order to have a universal control unit, in charge of capturing and decoding the instructions. At the end of the day what we are interested in is being able to operate with numbers in base 10 and not how.

Sistema binario

Little by little the binary system began to be standardized in computer processors as it was the simplest and easiest to implement, since it required fewer transistors. This relegated the use of decimal computing to specifically specialized units designed to operate in that way or to simple binary-to-decimal data conversion instructions.

In other words, computers can operate with decimal numbers and even more abstract concepts such as complex and imaginary numbers. Of course, making a processor that works in binary requires much less complications than making a decimal from zero. And it is that the best designed systems scale from the simplest, which is nothing other than working in binary.

Not available on tablets or PC

Finanzas Tablet

Decimal units have not been common in the PC CPUs that we use in our day to day life, but in a large multitude of sectors it is necessary to use units capable of working in base 10 at high speed to perform their calculations. In reality, the first computers were designed to work with decimal numbers, since these were not yet digital, but analog, and they were the electronic versions of the first mechanical calculators.

Currently no CPU architecture with both ISA ARM and x86 have the hardware that allows them to operate natively with base 10 numbers, but they include some instructions that allow converting data written in decimal to binary with a trade-off and that is the loss of precision of data, so the x86 processors we use in our PCs are not valid for certain applications and certain markets.

How is this possible if many people on PC work with accounting applications for example on a daily basis? The explanation is that the level of precision they require to work does not require a unit that operates directly with decimals and these applications make use of the conversion instructions in the ISA of both the PC and the tablet to do their work.

IBM is the queen of decimal computing

ibm power10

The oldest company in the hardware world is not Intel, but IBM. Historic company in the world of computing that has always had large contracts with the large banks of the United States since the 1950s. Since then, its mainframes with the ability to operate with decimal numbers carried accounting entries and various banking operations and financial, all of them operated on a base 10.

That’s why the original blue giant’s intended processors for large-scale business use include specialized units for decimal computing even today. Without going any further, the POWER processors in recent generations have included a unit with the ability to work with decimals, and without leaving the International Business Machines we have their System Z10 that make up a unit of this type.

So the banking and financial system of Europe and the United States has become an extremely lucrative market for the blue giant in recent decades, a case very similar to Fujitsu in Japan that with its ISA SP ARC processors, invented by Sun Microsystems, it has been the queen for years in the banks of the Japanese country and continues to be so even today.