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

*To*: Peter Lawrence <peterl95124@xxxxxxxxxxxxx>, "STDS-754@xxxxxxxxxxxxxxxxx" <STDS-754@xxxxxxxxxxxxxxxxx>*Subject*: RE: round32 ( round64 ( X ) ) ?= round32 ( X )*From*: "Golliver, Roger A" <roger.a.golliver@xxxxxxxxx>*Date*: Thu, 31 Mar 2011 16:00:47 -0700*Accept-language*: en-US*Acceptlanguage*: en-US*In-reply-to*: <AB99AEA5-CDB2-4BD5-B47D-D68CC6C4D1DF@SBCGLOBAL.NET>*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*: <AB99AEA5-CDB2-4BD5-B47D-D68CC6C4D1DF@SBCGLOBAL.NET>*Sender*: stds-754@xxxxxxxx*Thread-index*: Acvv9K+r57QTvWiTQK2r/76yxzT2dwAAnFJg*Thread-topic*: round32 ( round64 ( X ) ) ?= round32 ( X )

http://www.open-std.org/jtc1/sc22/jsg/docs/m3/docs/jsgn326.pdf It is known, but not well known. The Java Language Designers didn't know and didn't talk to their own in house numerics experts, like David Hough. See above link for some suggestions for how to avoid the double rounding error. Roger -----Original Message----- From: stds-754@xxxxxxxx [mailto:stds-754@xxxxxxxx] On Behalf Of Peter Lawrence Sent: Thursday, March 31, 2011 12:55 PM To: STDS-754@xxxxxxxxxxxxxxxxx Subject: round32 ( round64 ( X ) ) ?= round32 ( X ) all, my apologies in advance if this is trivial and/or non-sense, but I did not find the answer in a quick scan of David Goldberg's "What every computer scientist should know about floating point arithmetic", nor in other more specifically IEEE-754 documents that I have. consider the effect of first rounding (round-to-nearest-even) to some number of bits, followed by another rounding to a smaller number of bits, the question is is that always the same as directly rounding to the smaller number of bits. is the following observation mathematically (round-to-nearest-even) correct: the commas are for readability, the semicolons indicate where rounding is to take place: 1.aaaa0,10000;0xxx ==> 1.aaaa0,10000 1.aaaa0;10000 ==> 1.aaaa0 round to 10 bits, followed by round to 5 1.aaaa0;10000,0xxx ==> ==> 1.aaaa1 directly round to 5 bits (the "0xxx", and "0000,0xxx" are some of the bits of some mathematically exact result which are not all zeros, which would be represented by a non-zero "sticky bit" in an actual hardware implementation. In the first case the sticky bit gets truncated, in the second case the sticky bit causes a round upwards.) if the above is a correct observation, then round32 ( round64 ( X ) ) is not always equal to round32 ( X ) which seems sort of counter-intuitive, at least I started out thinking it would always be, but thought I had better prove it first, and then came up with this counter example. If it is true, I wonder if it is well known or not. sincerely, Peter Lawrence.

**Follow-Ups**:**RE: round32 ( round64 ( X ) ) ?= round32 ( X )***From:*Golliver, Roger A

**References**:**round32 ( round64 ( X ) ) ?= round32 ( X )***From:*Peter Lawrence

- Prev by Date:
**round32 ( round64 ( X ) ) ?= round32 ( X )** - Next by Date:
**Re: round32 ( round64 ( X ) ) ?= round32 ( X )** - Previous by thread:
**round32 ( round64 ( X ) ) ?= round32 ( X )** - Next by thread:
**RE: round32 ( round64 ( X ) ) ?= round32 ( X )** - Index(es):