Article View: comp.lang.forth
Article #154Re: Tests for (DDFS.)
From: Krishna Myneni
Date: Tue, 20 Oct 2026 18:48
Date: Tue, 20 Oct 2026 18:48
76 lines
4420 bytes
4420 bytes
On 10/20/26 12:41 PM, marcel hendrix wrote: > On 10/20/2026 7:26 PM, marcel hendrix wrote: >> On 10/20/2026 6:15 PM, Krishna Myneni wrote: >>> On 10/20/26 8:47 AM, Krishna Myneni wrote: >>> ... >>>> >>>> ... >>>> The output shows that (DDFS.) as presently implemented in dd_io.4th >>>> fails for one of the test cases (test 2), and probably for many more >>>> cases. >>>> ... >>> >>> Typing the string outputs from (FS.) and (DDFS.) shows that (DDFS.) >>> is not rounding properly. >> Simply setting the low part of a double double to 0 might be a bit too >> simplistic? Is the difference in the range of 1e-15 .. 1e-17 ? >> > > FORTH> 53-bits! S" 9.9999993504564039e-39" >DD fswap +E. 2 spaces +E. > 9.9999993504564044884e-0039 -2.4574614153997716484e-0056 ok > FORTH> 53-bits! S" 0.30000000000000003e0" >DD fswap +E. 2 spaces +E. > 3.0000000000000005126e-0001 -1.4408920985006246408e-0017 ok > FORTH> 53-bits! S" -1.0000000133514319e-10" >DD fswap +E. 2 spaces +E. > -1.0000000133514319362e-0010 6.0018089739605790726e-0027 ok > FORTH> 53-bits! S" -9007199254740991.5e0" >DD fswap +E. 2 spaces +E. > -9.0071992547409920000e+0015 5.0000000000000000000e-0001 ok > > The second number is critical, on the fourth one may be lucky because > the low word is exactly 0.5? > All of the doubles have 17 decimal digits, which means they reduce in double precision to a reproducible binary number. Furthermore, they are 17 digit roundings of exactly representable numbers in binary64. I don't believe there is a problem with using 0.0e0 for the second double for this case. One can see that even Bailey's ddfun conversion routines don't always reproduce the 32nd digit of the reference output (from (f.s)). Even in Bailey's paper [1], there are two different numbers given for the number of digits that are meaningful with respect to the input decimal string: "For some of these problems, twice the normal level, or roughly 32-digit accuracy, is sufficient." "DDFUN. This packages provide double-double (approx. 31 digits) arithmetic, in an all-Fortran-90 environment." "QD. This package includes routines to perform “double-double” (approx. 31 digits) and “quad-double” (approx. 62 digits) arithmetic. ... The QD package is much faster than using arbitrary precision software in applications where 31 or 62 digits is sufficient." It's not clear to me whether we can expect 32 digits of accuracy for an input decimal string to dd conversion or not, but he clearly states that one can only trust 31 digits from the ddfun package to be correctly rounded. The output of dp2_to_dd shows this to be the case. The output of the implementation of (DDFS.) tested here is clearly much worse than the matching of the reference string from the Fortran 90 ddfun conversion routine. -- KM [1]. High-Precision Floating-Point Arithmetic in Scientific Computation, David H. Bailey, 28 January 2005. ( I found this on the internet, but I have to find the link again )
Technical Details
Message-ID:
<11b8d2f$3935k$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11b7rcu$31u3u$1@dont-email.me> <11b8427$35l54$1@dont-email.me> <11b887g$p2rm$1@dont-email.me> <11b893q$27c2k$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Krishna Myneni <krishna.myneni@ccreweb.org> Newsgroups: comp.lang.forth Subject: Re: Tests for (DDFS.) Date: Tue, 20 Oct 2026 13:48:47 -0500 Organization: A noiseless patient Spider Lines: 76 Message-ID: <11b8d2f$3935k$1@dont-email.me> References: <11b7rcu$31u3u$1@dont-email.me> <11b8427$35l54$1@dont-email.me> <11b887g$p2rm$1@dont-email.me> <11b893q$27c2k$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 20 Oct 2026 18:48:49 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3443892"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kLzJDfg3h5YEVjaW+uTRs"; posting-host="a4217b4f3342bc26cffa14f31fc9d3e3" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:baneClprxk2oOIum2HXQzvyw2YI= sha256:mEq2zfqSGRtOoJOYPtcDsdVA2cp11ywzyA/x3OrlHdY= sha1:BpO1O2eWFJvtf+wM5m0mF/daShY= sha256:jfFZqlTpNsEra4bde1dthD5daIyup3X9VF+l2Nqzjok= Content-Language: en-US In-Reply-To: <11b893q$27c2k$1@dont-email.me>