🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #161

Re: Tests for (DDFS.)

#161
From: Krishna Myneni
Date: Wed, 21 Oct 2026 08:50
94 lines
4682 bytes
On 10/20/26 8:05 PM, Krishna Myneni wrote:

> ... 
> === 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 ===
> 

I post the execution output from dp2_to_dd for the 4 test cases in 
ddfsdot-test.4th for anyone who wants to reproduce this output. The hex 
values of the two double precision numbers input to the program are 
shown (the second number is, of course, 64-bit 0). Note that the "D" 
exponent marker must be used to enter a double precision number in Fortran.

( 1)
$ ./dp2_to_dd
  Enter a pair of double precision (DP) numbers:
0.30000000000000003d0,0.0d0
  The two DP numbers are:
        0.30000000000000004E+00         0.00000000000000000E+00
  The two DP hex values are:
3FD3333333333334                 0
  The double double (DD) value of the pair is:
3.0000000000000004440892098500626e-1

( 2)
$ ./dp2_to_dd
  Enter a pair of double precision (DP) numbers:
9.9999993504564039d-39,0.0d0
  The two DP numbers are:
        0.99999993504564039E-38         0.00000000000000000E+00
  The two DP hex values are:
380B38FB80000000                 0
  The double double (DD) value of the pair is:
9.9999993504564039245746141539976e-39

( 3)
$ ./dp2_to_dd
  Enter a pair of double precision (DP) numbers:
-1.0000000133514319d-10,0.0d0
  The two DP numbers are:
       -0.10000000133514320E-09         0.00000000000000000E+00
  The two DP hex values are:
BDDB7CDFE0000000                 0
  The double double (DD) value of the pair is:
-1.0000000133514319600180897396057e-10

( 4)
$ ./dp2_to_dd
  Enter a pair of double precision (DP) numbers:
-9007199254740991.5d0,0.0d0
  The two DP numbers are:
       -0.90071992547409920E+16         0.00000000000000000E+00
  The two DP hex values are:
C340000000000000                 0
  The double double (DD) value of the pair is:
-9.0071992547409920000000000000000e15
Technical Details
Message-ID: <11b9ud7$3oofr$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> <11b935k$3gr0s$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: Wed, 21 Oct 2026 03:50:47 -0500
Organization: A noiseless patient Spider
Lines: 94
Message-ID: <11b9ud7$3oofr$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>
 <11b935k$3gr0s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Oct 2026 08:50:49 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3957243"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18tZDz1YYQFF/P3njqWaexE"; posting-host="fb81cdbe9bb503afc36aa811300a6187"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8behDyShscvfP/OPfoUdmfl6SaI= sha256:gy3sZoElCWdBv6NxktULw1vSEKIH8xw6WQ0QYeQTDZY=
	sha1:59U1XQVyzOeqIJ3NYd8X5SliEa0= sha256:y7bAcdJfjHFnmvSefktK5aFoltwx78NaDs6AH9hP5tU=
Content-Language: en-US
In-Reply-To: <11b935k$3gr0s$1@dont-email.me>