delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/09/14:21:56

From: Valery FINE <fine AT cn DOT msm DOT cern DOT ch>
To: DJ <dj AT ctron DOT com>, DJGPP <djgpp AT sun DOT soe DOT clarkson DOT edu>
Subject: emu387 bug.
Date: Thu, 09 Jun 94 19:15:00 MET
Encoding: 71 TEXT



     I tried the following fortran with f2c+gcc:



            program test_r
            i = 0
   10     continue
            i = i+1
            f = ranf(float(i))
            if (f .le. 1 .and. f .ge. 0) go to 10
            print *, i, 2*f

            end

            REAL FUNCTION RANF(seed)
            DOUBLE PRECISION    DS(2),    DM(2),    DSEED
            DOUBLE PRECISION    DX24,     DX48,     dddd
          DOUBLE PRECISION    DL,       DC,       DU,       DR
            DATA      DS     /  1665 1885.D0, 286 8876.D0  /
          DATA      DM     /  1518 4245.D0, 265 1554.D0  /
          DATA      DX24   /  1677 7216.D0  /
          DATA      DX48   /  281 4749 7671 0656.D0  /
          DL  =  DS(1) * DM(1)
          DC  =  DINT(DL/DX24)
          DL  =  DL - DC*DX24
          DU  =  DS(1)*DM(2) + DS(2)*DM(1) + DC
          DS(2)  =  DU - DINT(DU/DX24)*DX24
            DS(1)  =  DL
            dddd = DS(2)*DX24 + DS(1)
            DR     =  dddd / DX48
            print *,' DR =', DR, dddd
            RANF  =  DR
            RETURN
          END


   It runs fine on a system equipped with co-processor while failed with 
emu387 on 192th step. I.e. 191 steps  was OK. I am enclosing the tail of the 
listing below:

    DR =  .580113649  1.63287476E+14

               . . .
               . . .
               . . .

  DR =  .14786386  4.16199766E+13
  DR =  .50495889  1.42133292E+14
  DR =  .305742145  8.60587633E+13
  DR =  .378432071  1.06519158E+14
  DR =  .180708543  5.08649329E+13
  DR =  .263449057  7.41543173E+13
  DR =  .815921295  2.29661428E+14
  DR =  .301513285  8.48684448E+13
  DR =  .981306256  2.76213155E+14

  DR = -16777216. -4.72236648E+21

 192 -33554430.

  Any ideas will be appreciated

     Valery Fine (fine AT vxcern DOT cern DOT ch)
==============





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019