Ameba Ownd

アプリで簡単、無料ホームページ作成

Why bcd is used

2022.01.11 15:56




















Active Oldest Votes. Paul R Paul R k 33 33 gold badges silver badges bronze badges. I'm not sure what would be "better" than using the hardware datatype. I doubt modern x86 CPU's have optimized BCD implementations - they are probably implemented as microcode with a focus on compatibility, not performance.


Jay Conrod Jay Conrod This is the best answer. Displaying a non-BCD number on 7-segment or similar displays is a logical nightmare. Exact arithmetic calculations on arbitrary size numbers can also easily be done on normal binary numbers with normal binary numbers.


But if you change to real numbers, binary representation sucks, that is what you call Float. Not just converting. If you use a base-2 big integer to represent a big decimal type, you'll soon find that rounding is incredibly slow—you have to divide by some large power of So, what ends up happening is an addition might be quick, but it still needs to be rounded down to the desired precision which means your addition is really a small add and a large divide.


Quite slow. BCD doesn't have this problem. The multi-threading argument isn't convincing, unless you mean something requring access to the decimal digits of a number which is horribly slow for extended-precision binary BigInts.


If you can multi-thread BCD addition or mulitplication or whatever, you can also multi-thread over 32 or bit chunks of a binary biginteger. But usually you can't multithread or even SIMD because you need carry propagation when adding. Nubok 3, 6 6 gold badges 25 25 silver badges 45 45 bronze badges. Michael Michael Michael: I don't recall the x86 instructions for BCD. Can you remind me, please? There may be a few others, been a while I didn't play with that ;- — mjv.


I had totally forgotten about those. I barely remember even having seen an example of using those - and that wasn't a real-world example. David David 66 1 1 silver badge 1 1 bronze badge. Some modern architectures have hardware support for decimal float like Power6 and IBM z10 — phuclv. Nij Nij 1, 1 1 gold badge 21 21 silver badges 26 26 bronze badges. Some floating-point formats for the were decimal based.


MOS technologies' KIMath software published in print form used unpacked decimal mantissa with binary exponent for calculation and packed decimal for storage. In pure binary, non-integers, meaning numbers with fractions or decimals, are often infinite.


This means that, in theory, the binary representation of that non-integer could produce an endless string of digits. With BCD, however, non-integers have a finite number of digits. This makes it far easier to minimize mistakes and calculate non-integer values with BCD compared to pure binary. When converting BCD to a display designed for humans, such as for digital clocks, the process is relatively simple.


Conversions from pure binary, however, can become more complex. This is in part because there is no algorithm that can convert linear time into pure binary code. Related: Qualitative Data Examples and Types. BCD makes it easier to handle decimal digits in human numerals. With BCD, it's simpler to round, add, align or subtract decimal values. These processes, however, are more complex with pure binary. Pure binary may be more common than BCD on devices that require incredibly fast operational speeds.


This is in part because typical BCD requires four bits, or sometimes more, for each digit. That many digits can sometimes slow down the speed of devices that require speedy operational power. By contrast, pure binary rarely uses as many digits, so pure binary can reduce the processing time of those devices. Plus When To Use Them. Here are the principal benefits of using BCD in automation:.


BCD simplifies the conversions between numerical values used by machines and others used by humans. BCD makes it easy for humans to encode decimal values into a language that machines can understand. Related: 71 Technical Terms Used in Technology. Computers don't know how to read decimal points used in human calculations and algorithms.


The BCD converts decimal values into a format that computers can easily understand. This topic This board Entire forum Google Bing. Binary coded Decimal. Print Search. Pages: [ 1 ] Go Down. Binary coded Decimal Read times. Hello, I was trying to understand why we use BCD codes?


I only understand that instead of operating the whole decimal number, each decimal number is converted to 4-bit or 8-bit binary and then operated on, which might be considered a BCD and easy code to work with.


But can you please help me understand any application with some easy example if possible or the concept on why we do this? Is there any links to further understand this concept? Please feel free to correct me if my understanding of BCD is itself not correct. Thank you in advance! Electro Fan Super Contributor Posts: By employing BCD, the manipulation of numerical data for display can be greatly simplified by treating each digit as a separate single sub-circuit.


This matches much more closely the physical reality of display hardware—a designer might choose to use a series of separate identical seven-segment displays to build a metering circuit, for example.


If the numeric quantity were stored and manipulated as pure binary, interfacing to such a display would require complex circuitry. This is 3 digits longer than the real binary equivalent of , , but it has several advantages:. Converting binary number example: is binary to binary-coded decimal reads as 10, , can be done by dividing by 10 decimal.


The remainder is the digit starting at the ones place, and the quotient is to be divided by 10 again and the quotient would be the next digit. This step repeats until the quotient is 0.