🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #158

Re: Tests for (DDFS.)

#158
From: Krishna Myneni
Date: Wed, 21 Oct 2026 01:05
72 lines
4050 bytes
On 10/20/26 7:15 PM, dxf wrote:
> On 21/10/2026 4:26 am, 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 ?
> 
> I wasn't aware any JVN packages performed rounding.  AFAIK some implementations
> (yours?) limited numbers printed to PRECISION but that this was truncation - not
> rounding.  Rounding presented a whole new problem - why I never attempted it.
> 

The present iteration of (DDFS.) in kForth's dd_io.4th includes some 
changes you introduced. I would have to back and check JVN's original 
code (which uses a state machine) to see it performs differently than 
the subroutine ddwrite() in Bailey's ddfun Fortran 90 package, which is 
what is used in my program dp2_to_dd.f90 (listed below).

It is more productive to make (DDFS.) a Forth equivalent to ddwrite(), 
to provide the same performance.

What does your present version of (DDFS.) output on these tests?

--
KM

=== begin code for dp2_to_dd ===
! dp2_to_dd.f90
!
! K. Myneni, 16 Sep 2026
!
! Input a double double precision (DD) number as a
! pair of double precision (DP) numbers and display
! the DD number in scientific notation. The program
! also displays the input DP numbers in scientific
! notation and their hex values.
!
! Build:
!   $ gfortran -O3 -o dp2_to_dd dp2_to_dd.f90 ddmodule.o ddfuna.o 
ddfune.o second.o
!
! Build assumes you have built the Fortran ddfun-v04 package using the
!   shell script gnu-complib-dd.scr
! The script will generate the .o files for linking to the program below.
!
! Revisions:
!   2026-09-18 km; directly set the two DP numbers of a DD variable
!
program dp2todd
         use ddmodule
         implicit none
         real (ddknd) a(2)
         type (dd_real) t1, t2
         print *, 'Enter a pair of double precision (DP) numbers:'
         read(*, '(D28.16,D28.16)') a(1), a(2)
         print *, 'The two DP numbers are:'
         write(*,'(E30.17,2X,E30.17)') a(1), a(2)
         print *, 'The two DP hex values are:'
         write(*, '(Z16,2X,Z16)') a(1), a(2)
         print *, 'The double double (DD) value of the pair is:'
         t1%ddr(1) = a(1)
         t1%ddr(2) = a(2)
         call ddwrite(6,40,32,t1)
end program dp2todd
=== end code ===
Technical Details
Message-ID: <11b935k$3gr0s$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-mail
References: <11b7rcu$31u3u$1@dont-email.me> <11b8427$35l54$1@dont-email.me> <11b887g$p2rm$1@dont-email.me> <6ad8043a$1@news.ausics.net>

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 20:05:56 -0500
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <11b935k$3gr0s$1@dont-email.me>
References: <11b7rcu$31u3u$1@dont-email.me> <11b8427$35l54$1@dont-email.me>
 <11b887g$p2rm$1@dont-email.me> <6ad8043a$1@news.ausics.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Oct 2026 01:05:57 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3697692"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/M1HHFb8u7tT69xwznzZQR"; posting-host="fb81cdbe9bb503afc36aa811300a6187"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:9NnyZpighnMFuk17DTACzqnXOmQ= sha256:BurrbA2TyYgP3ihkt9+oYajBWZy7ba8azRxVwJ9LXMo=
	sha1:p/J+kb/9sD7EGnSPRTvU4bfslg0= sha256:gNRLTXwV8+eLVEFzJ74qS19frPayCkrC/BRRQPSaZaw=
Content-Language: en-US
In-Reply-To: <6ad8043a$1@news.ausics.net>