Jump to content

Talk:Binary-coded decimal

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

this phrase at the start of the article makes no sense[edit]

"However, decimal fixed-point and floating-point formats are still important and continue to be used in financial, commercial, and industrial computing, where the subtle conversion and fractional rounding errors that are inherent in floating point binary representations cannot be tolerated."

floating point format is still used... where its its rounding errors cannot be tolerated? — Preceding unsigned comment added by 189.6.25.85 (talk) 13:05, 12 January 2022 (UTC)[reply]

IEEE 754 now supports float decimal formats, and IBM (at least) has implemented them in hardware. There is some suggestion that they are there for financial reasons, but I don't believe that is true. Fixed decimal, yes. According to Donald Knuth finance and typesetting should be done in fixed point. And yes some finance calculations depend on decimal rounding, though not hard to do in binary. Gah4 (talk) 22:27, 12 January 2022 (UTC)[reply]
I agree that sentence *sounds* like a self-contradition. It also *seems* to imply that "formats" are somehow different from "representations", although they are synonyms in this article.
I think this sentence was intended to distinguish between (as Gah4 points out) "decimal floating-point formats" vs. "binary floating-point formats", so I tried to clarify it to say something more like
"decimal floating-point formats are still ... used ... where ... errors that are inherent in binary floating point formats cannot be tolerated."
Other places in this article still seem to imply that "binary representations", "decimal representations", "decimal formats", "binary formats" are four different things. Would it make this article easier to understand if it (a) explicitly said "representation" is a synonym for "format" in this article, or (b) avoided ever using "representation", using "format" instead, or (c) avoid ever using "format", using "representation" instead? --DavidCary (talk) 19:36, 11 June 2022 (UTC)[reply]
I suppose that there is a small difference between format and representation, but maybe small enough not to notice. Gah4 (talk) 21:56, 11 June 2022 (UTC)[reply]

Editing for tone and clarity[edit]

The current state of the article has been flagged by Wikipedia as a C-Class. (Wikipedia:Content assessment) I will be working on this article for the next few weeks to raise these standards.

My focus will be to make bold and frequent edits to close gaps in content and solve cleanup problems through structure and reorganization of information. BMarie 212 (talk) 22:26, 16 March 2024 (UTC)[reply]

Merge with Decimal data type and extend for DBMS[edit]

Can I suggest that Decimal data type be merged into this article and extended to cover the extensive use of the DECIMAL data type in database systems such as SQL Server and Sybase? It's also not clear how computers perform decimal arithmetic, it seems unlikely they use Intel BCD opcodes due to the substantial overhead required. 2403:5804:7C87:0:F9AF:1DC7:C18C:20EC (talk) 05:09, 26 June 2024 (UTC)[reply]

Can I suggest that Decimal data type be merged into this article... Sounds reasonable, although that material should do a better job of distinguishing between fixed-point and floating-point decimal (decimal arithmetic predates the IEEE floating-decimal standard, and many system supported only fixed-point decimal in hardware/microcode/supprt subroutines).
As for how it's done, most instruction sets - even the ones that are currently being used - aren't x86 and thus don't even have the Intel BCD opcodes. Even x86-64 doesn't support them in long mode.
Some instruction sets have decimal arithmetic instructions. The IBM System/360 architecture, and its successors, have variable-length fixed-point-decimal instructions.
Other instruction sets have "decimal arithmetic assist" instructions. The Power ISA, as of version 3.0, has instructions that take two registers containing 64-bit packed decimal values made up of 16 4-bit digits and add the digits separately (but in one cycle), with the carry not propagated from digit to digit. The result is put in in one of the two registers, and an another 64-bit result with 16 4-bit values, each of which is either 6 if the corresponding 4-bit digit sum had a carry or 0 if it didn't, is put into a third register, to be used to do carry propagation. Some earlier PowerPC/Power ISA processors had a similar assist instruction; see this USENET post. That one may only have been available in the "tags active" mode that the [[AS/400] used. In the USENET post to which that's a reply, John Mashey talks about PA-RISC having decimal assist instructions and MIPS not having them as they thought that they weren't necessary to make decimal arithmetic "fast enough". See, for example, this Stack Overflow post.
So that's probably how it's typically done these days - there might be hardware assists to help out with carries when doing addition and subtraction, or that might be done with a few more instructions if those hardware assists are absent. Guy Harris (talk) 07:21, 26 June 2024 (UTC)[reply]