Talk:Decimal floating point
This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||
|
Fractions
editI changed 'exponent' to 'fraction' in the second sentence. Some might disagree, but the problem with binary floating point is pretty much that most decimal fractions can't be represented exactly. It really has little to do with the exponent, and is also true for scaled fixed point values in bases other than ten. That is, ones where the radix point is to the left of the least significant digit.
As to the why and 'why now' for decimal floating point, modern processors have room for enough transistors, and are for the most part fast enough, that the small extra cost to do decimal floating point is more than made up by the advantage of giving the results that people expect. Gah4 (talk) 21:03, 10 July 2009 (UTC)
What should be on this page
editIn my opinion, this page should be a summary of floating point that is specific to radix 10 designs, and mention of the history and use of decimal floating point. In particular IEEE 854, IEEE 754r, java (programming language) big decimal, perl, emacs calc, python (programming language), Maple (software), calculator, abacus, slide rule, the Smallwood calculator. This might be a good place to discuss some anomalies that arise when trying to "fake" decimal arithmetic with binary, e.g., in a spreadsheet. It should not be a complete redo of floating point or IEEE 754r. In particular, anything beyond passing reference to BID or DPD encodings should be referred to 754r. This is a sketch of the direction I'll head when I have the time. Feel free to pitch in.... ;-> ---Jake 00:12, 2 October 2007 (UTC)
Implementations
editI don't believe that an abacus, as normally used, is an implementation of floating point. I suppose one could keep an exponent on some columns of an abacus, but unless that is done, scaled fixed point seems a better description. Also for a slide rule where the user keeps track of the exponent position. Gah4 (talk) 20:21, 18 July 2009 (UTC)
References need cleanup
editI don't really have a knack for the references in Wikipedia. If someone could take a crack and getting the citations pulled out of the article and incorporated as traditional references, that would be great. --Jake 01:56, 2 October 2007 (UTC)
Intel / AMD CPU Hardware Support
editPerhaps it should be noted that Intel/AMD CPUs (with 80387 compatible floating-point units) have limited BCD / fixed point / decimal floating-point support: The FBLD and FBSTP instructions, which load/store 18-digit BCD numbers (converted as integers to/from 80-bit binary floating-point). This enables implementation of fixed-point and decimal floating-point libraries required for some programming languages (like BASIC, the standard of which requires decimal floating-point). This is because some languages require exactness of floating-point numbers which is not given using binary floating-point. 79.227.134.166 (talk) 07:35, 30 March 2015 (UTC)
The x87 converts between BCD integers and internal (temporary real) format. That might be a little help in a software implementation of decimal float, but not a big help. It is probably most useful in the initial and final conversions. Gah4 (talk) 08:27, 31 March 2015 (UTC)
PL/I
editSome computer languages have implementations of decimal floating-point arithmetic, including PL/I, I don't know if it is completely obvious that PL/I intended a decimal representation, instead of describing the needed precision in decimal digits. Some PL/I compilers implement FIXED DECIMAL in binary arithmetic, (with appropriate scaling) which also works. It is, however, convenient for machines that implement decimal and another radix, to use the PL/I keywords to choose. (PL/I was created along with S/360, which used radix 16 floating point.) Gah4 (talk) 05:09, 18 September 2016 (UTC)
Decimal256 and x86
editThe table follows the format from this article:
decimal32 | decimal64 | decimal128 | decimal(32k) | Format |
---|---|---|---|---|
1 | 1 | 1 | 1 | Sign field (bits) |
5 | 5 | 5 | 5 | Combination field (bits) |
6 | 8 | 12 | w = 2×k + 4 | Exponent continuation field (bits) |
20 | 50 | 110 | t = 30×k−10 | Coefficient continuation field (bits) |
32 | 64 | 128 | 32×k | Total size (bits) |
7 | 16 | 34 | p = 3×t/10+1 = 9×k−2 | Coefficient size (decimal digits) |
192 | 768 | 12288 | 3×2w = 48×4k | Exponent range |
96 | 384 | 6144 | Emax = 3×2w−1 | Largest value is 9.99...×10Emax |
−95 | −383 | −6143 | Emin = 1−Emax | Smallest normalized value is 1.00...×10Emin |
−101 | −398 | −6176 | Etiny = 2−p−Emax | Smallest non-zero value is 1×10Etiny |
As it come from the table, the Decimal256 floating point format would be:
Decimal256 | sign | combination | exponent continuation | coefficient continuation |
---|---|---|---|---|
1 | 5 bits | 20 bits : 3,145,728 | 230 bits : 70 | |
Total bits: 256 | ||||
x86 decimal format | sign | combination | exponent continuation | coefficient continuation |
1 | 5 bits | 9 bits : 1,536 | 65 bits : 20.5 | |
Total bits: 256 |
- I can't find the source here and the Google search due to the original research. Exessia (talk) 09:11, 30 June 2019 (UTC)
software
editI suppose that software implementations are applicable here, though it might be that we should so indicate. I believe that the IBM 650 does it in software, using the fixed decimal hardware. Also, I believe that there are microcomputer (8080, 6502, etc.) BASIC systems with float decimal implementations. Gah4 (talk) 06:13, 19 August 2019 (UTC)
On the other hand, it isn't completely obvious that PL/I designers necessarily intended for decimal floating point implementations. It is convenient to specify the desired precision in decimal digits, even though the underlying representation is not decimal. (See Fortran's SELELCTED_REAL_KIND, for an example.) PL/I's FIXED DECIMAL can be implemented in binary with the appropriate scaling by powers of 10, and I know at least one implementation that does so. It is convenient, on processors that implement both binary and decimal floating point, for PL/I implementations to use the BINARY and DECIMAL attributes to select between them. Gah4 (talk) 06:13, 19 August 2019 (UTC)
external links
editWhy the removal of external links? They seemed useful enough to me. Can they be fixed enough to restore? Gah4 (talk) 23:23, 2 February 2021 (UTC)
Short description|Decimal representation of real numbers in computing
editThe current Short description|Decimal representation of real numbers in computing seems to follow the Fortran tradition of naming a data type. In the PL/I tradition, both fixed point and floating point data can be REAL
, or the alternative COMPLEX
, and fixed point data can have the radix point (decimal or binary) not only to the right of the LSD. Many other languages don't name a data type REAL
, fixed or floating point. Gah4 (talk) 02:12, 6 February 2022 (UTC)
Java BigDecimal
editJava BigDecimal is implemented using arbitrary precision. It uses an arbitrary precision BigInteger for the significand and a regular integer for the scale/exponent.
The official JavaDoc has a relatively new discussion about the relationship between BigDecimal and IEEE 754
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/math/BigDecimal.html#relation-to-ieee-754-decimal-arithmetic-heading Jebuswankel (talk) 05:13, 7 July 2024 (UTC)