[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: IEEE 754 <stds-754@xxxxxxxxxxxxxxxxx>*Subject*: RE: Implementor support for the binary interchange formats*From*: Charles Stevens <charles.stevens@xxxxxxxx>*Date*: Mon, 28 Feb 2011 14:38:27 -0700*Importance*: Normal*In-reply-to*: <201102281835.p1SIZvIT032091@d01av01.pok.ibm.com>*List-help*: <http://listserv.ieee.org/cgi-bin/wa?LIST=STDS-754>, <mailto:LISTSERV@LISTSERV.IEEE.ORG?body=INFO%20STDS-754>*List-owner*: <mailto:STDS-754-request@LISTSERV.IEEE.ORG>*List-subscribe*: <mailto:STDS-754-subscribe-request@LISTSERV.IEEE.ORG>*List-unsubscribe*: <mailto:STDS-754-unsubscribe-request@LISTSERV.IEEE.ORG>*References*: <201102281835.p1SIZvIT032091@d01av01.pok.ibm.com>*Sender*: stds-754@xxxxxxxx

> Since binary128 supports 34-bit integers EXACTLY, there should be zero > precision loss for traditional COBOL usage of scaled decimal (e.g. by > handling currency in micropennies). ummm ... binary128 actuallly supports 34-digit decimal INTEGERS exactly. And, yes, COBOL has been handling this well for years. Even using the "new" standard modes of arithmetic, COBOL would continue to treat such fixed-point operands as integers and apply the scaling separately. The 2002 standard added floating-point data items (USAGE FLOAT-SHORT, FLOAT-LONG, and FLOAT-EXTENDED, with the specifications left to the implementor) to provide a "standardized" equivalent to what implementors had had for years (e.g., USAGE REAL and USAGE DOUBLE in Burroughs B6700 COBOL68). They also provided for floating-point numeric literals, as well as floating-point edited items that include the signed exponent. In the 2002 standard, if "native arithemtic" is in effect, what you get on any arithmetic operation is what the implementor says you're gonna get. Under "standard arithmetic", though, the form in which all operands to arithmetic, and all results, are put is n "abstract, signed, normalized decimal floating-point item. The format of this item is such that it can contain a normalized significand of 32 decimal digits", and the overall magnitude range is specified as being from (10**(-999)) to (10**1000 - 10**968) inclusive. The precedent for floating-point handling is already in the published standard. What we're doing here in the draft is building on that precedent based on an external industry standard rather than on further COBOL extractions. In fact, the draft marks "arithmetic is standard" as an obsolete feature, to be removed in the NEXT revision, even though it's only been in a single edition of the standard so far. Yes, historically, *standard* COBOL has dealt only in fixed-point numerics. Many (and probably most) had floating-point extensions, and in 2002 *standard* COBOL began dealing in floating-point numerics in response to that market force. > But, as William Klein pointed out: > > 1) Arithmetic mode PRIMARILY deals with "intermediate results". > > So operations like (7 / 4 ) * 4 could be affected. Yes, they could, in NATIVE arithmetic as compared to STANDARD arithmetic. And it's precisely to avoid answers like "1" that "standard arithmetic" was introduced. In 2002 COBOL STANDARD arithmetic, this would be something along these lines. a) Store the decimal numeric value 7 in decimal floating-point temporary #1 (+7.00000000000000000000000000000000e0) b) Store the decimal numeric value 4 in decimal floating-point temporary #2 (+4.00000000000000000000000000000000e0) c) Divide temporary #1 by temporary #2, storing the result in temporary #1 (+1.75000000000000000000000000000000e0) d) Store the decimal numeric value 4 in temporary #2 (+4.00000000000000000000000000000000e0), e) Multiply temporary #1 by temporary #2, storing the result in temporary #1 (+7.00000000000000000000000000000000e0). f) Convert the value in temporary #1 into whatever form is specified by the receiving field. Floating-point isn't foreign to COBOL. I grant that it was foreign to STANDARD COBOL until the '02 standard, but it ain't no more. Note also that the value in EVERY SINGLE fixed-point numeric data item can be represented EXACTLY as an integer OR as a fixed-point value in a decimal128 item (of either encoding). Every allowed decimal INTEGER can be likewise stored in a binary128 item; things begin to go awry with precision loss when poers-of-two scale factors are applied. -Chuck Stevens |

**References**:**Implementor support for the binary interchange formats***From:*Michel Hack

- Prev by Date:
**RE: Two technical questions on IEEE Std 754-2008** - Next by Date:
**RE: Two technical questions on IEEE Std 754-2008** - Previous by thread:
**Implementor support for the binary interchange formats** - Next by thread:
**RE: Two technical questions on IEEE Std 754-2008** - Index(es):