[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

SIN/COS broken in gfortran on mipsel? Test request



Dear list,

I find it hard to believe, but it seems that the SIN() and COS()
built-ins might be broken in gfortran on mipsel.  See this build log for
instance, search in it for the string "Testing Routine B101" and look at
the table following that string:

http://buildd.debian.org/fetch.cgi?&pkg=cernlib&ver=2006.dfsg.2-12&arch=mipsel&stamp=1205698992&file=log

Judging by this build log, the SIN(x) and COS(x) functions on mipsel
apparently return 0 and 1 respectively for x > 0 (and do not give the
right values even for x = 0).

Unfortunately, as far as I know there are no currently available
mips/mipsel machines for developers to use, so I need to ask this list
for help.  I'm attaching a stand-alone version of this test as file
"sincos.F".  If someone running the latest Sid on a mipsel architecture
wouldn't mind, please install the latest gfortran-4.3 package, run the
following and see what you get:

gfortran-4.3 -O2 sincos.F -o a.out
./a.out

What you *should* get is something like the following: (obviously the
exact errors will vary depending on floating point variations, but
should be less than 1.0E-07)

        For A=I*PI/180:

     I   X=SIN(A)    Y=COS(A)        ATG(X,Y)    Error
     0   0.0000000   1.0000000      0.0000000   0.0E+00
    10   0.1736482   0.9848077      0.1745329   0.9E-07
    20   0.3420202   0.9396926      0.3490659   0.0E+00
[snip]
       Largest Error for ATG was   0.9E-07


If the same bug as seen in the cernlib build log manifests itself, you
will get something more like this:

        For A=I*PI/180:

     I   X=SIN(A)    Y=COS(A)        ATG(X,Y)    Error
     0   0.9869969   0.1607389      1.4093571   0.0E+00
    10   0.0000000   1.0000000      0.0000000   0.1E+01
    20   0.0000000   1.0000000      0.0000000   0.1E+01
[snip]
       Largest Error for ATG was   0.1E+01


Please let me know (CC: to my email address) what is actually obtained
on mipsel (and also on big-endian mips if possible).

If you do get results significantly different from those shown above,
please try compiling at lower optimization levels down to -O0 and see
whether any of them give the correct results.

Thank you and best regards,

-- 
Kevin B. McCarty <kmccarty@gmail.com>
WWW: http://www.starplot.org/
WWW: http://people.debian.org/~kmccarty/
GPG: public key ID 4F83C751
      PROGRAM B101M

C     Specify the largest error allowed for a successful test
      PARAMETER ( TSTERR=1D-6 )

      WRITE(6,'(/8X,''For A=I*PI/180:'')')
      WRITE(6,'(/5X,''I'',3X,''X=SIN(A)'',4X,''Y=COS(A)'',8X,
     +                 ''ATG(X,Y)'',4X,''Error'')')
      ER=0E0
      ERMAX=0E0
      PI = 3.14159 26535 89793D0
      DO 1 I = 0,350,10
      A=I*PI/180
      X1=SIN(A)
      X2=COS(A)
      R1=ATG(X1,X2)
      IF (A .NE. 0.)ER=ABS((R1-A)/A)
      ERMAX=MAX(ERMAX,ER)
      WRITE(6,'(1X,I5,2F12.7,F15.7,E10.1)') I,X1,X2,R1,ER
    1 CONTINUE
      WRITE(6,'(/7X,''Largest Error for ATG was'',E10.1)')ERMAX
      END

      FUNCTION ATG(X1,X2)

      PARAMETER (PI = 3.14159 26535 89793D0)

      ATG=ATAN2(X1,X2)+(PI-SIGN(PI,X1))
      RETURN
      END

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: