Re: Fortran decimal anyone?

From: David Frank (dave_frank_at_hotmail.com)
Date: 05/14/04


Date: Fri, 14 May 2004 08:05:31 GMT


"Mike Cowlishaw" <mfc@uk.ibm.com> wrote in message
news:c7vusr$hvs$1@news.btv.ibm.com...
> John H. Lindsay wrote:
>> Hi Fortranners:
>>
>> While looking at the problem of supporting packed and unpacked
>> decimal data strings (and at the same time the problems in doing
>> arbitrary precision integer and fixed point decimal and fixed
>> point binary arithmetic) in SNOBOL4 under OS/2, I made a list of
>> the internal representations of fixed point decimal data that I
>> had seen on Intel hardware, some immediate extensions thereof and
>> alternates thereto. ...
>
> Nice list! And nicely illustrates why I've spent much of the past
> seven years on standardizing decimal data format(s).
>
> Also worth noting that the trend in decimal arithmetic in
> languages has been very much towards floating-point in
> recent years (for example Java, C#, VB, Rexx, etc.).
>
> Mike Cowlishaw
>
>

Mike,
re: your Telco Million call benchmark

I will chime in for my fav language Fortran,
perhaps you can supply missing info in below scorecard?
(I have already sent you a 30 line source of my DollarCents module
 that abandons using Alan Miller's 2000+ statement quad floating module
 to get below task executed)

1. Fortran 25 statements 3 sec to execute (David Frank)
2. Cobol 83 statements 23 sec to execute (William Klein)
3. C ? ( Mike
Cowlishaw)
4. C# ? "
5. Java ? "
6. C++ ? "
7. PL/I ?
! ---------------------
PROGRAM Telco_Million_Calls ! from expon180.1e6 file
use DollarCents
real(8) :: brate = 0.13d0, drate = 0.894d0
real(8) :: btax = 0.0675d0, dtax = 0.0341d0
integer(8) :: time, p, b, d, sumb, sumd, sumt
integer(1) :: tb(8); equivalence (tb,time)

open (1,file='expon180.1e6',form='binary') ! 8-byte integers
sumb = 0.0 ; sumd = 0.0 ; sumt = 0.0
do
   read (1,end=101) (tb(i),i=8,1,-1) ! big-endian 8-byte integer
   if (iand(time,1) == 0) then ! Local call
      p = Mul(time,brate,bankers) ; b = Mul(p,btax)
      sumb = sumb +b ; sumt = sumt+p+b
   else ! Distance call
      p = Mul(time,drate,bankers) ; b = Mul(p,btax) ; sumb = sumb+b
      d = Mul(p,dtax) ; sumd = sumd +d ; sumt = sumt+p+b+d
   end if
end do
101 write (*,'(a,f10.2)') 'SumT = ', sumt/1D2, &
                          'SumB = ', sumb/1D2, &
                          'SumD = ', sumd/1D2
END PROGRAM Telco_Million_Calls
Outputs:
SumT = 1004737.58
SumB = 57628.30
SumD = 25042.17