From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,e95f364e8526ca2b X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-07-11 14:44:43 PST Path: bga.com!news.sprintlink.net!get.hooked.net!decwrl!pa.dec.com!jac.zko.dec.com!quark.enet.dec.com!lionel From: lionel@quark.enet.dec.com (Steve Lionel) Newsgroups: comp.sys.dec Subject: Re: Q:Fortran V6.2 query Date: 11 Jul 1994 15:50:37 GMT Organization: Digital Equipment Corporation, Nashua NH Distribution: world Message-ID: <2vrpod$s3l@jac.zko.dec.com> References: <1994Jul11.154453@rzhp9a.gsi.de> Reply-To: lionel@quark.enet.dec.com (Steve Lionel) NNTP-Posting-Host: quark.zko.dec.com Keywords: DEC Fortran V6.2-508, OpenVMS AXP, math library, cosd, optimizer X-Newsreader: mxrn 6.18-17 In article <1994Jul11.154453@rzhp9a.gsi.de>, kaspar@rzhp9a.gsi.de (Matthias Kaspar) writes: |>A colleague of mine recently experienced some problems with |>the cosd() function of the DEC Fortran Compiler V6.2-508 which |>has been installed together with OpenVMS 6.1 on our AXP cluster |>about three weeks ago. Finally, he came up with a piece of code |>which (slightly modified) looks like this... |> |> program test |> |> integer count |> real*4 argument |> do count=1,20 |> argument=89.99999+1.0e-06*float(count) |> write(6,*)count,argument,cosd(argument),sind(argument) |> end do |> end |> |> |>Try to compile this with the default qualifiers. |> |>When count reaches 4, argument comes close to 90.0. |>However, the cosd() call does not return zero, but NaN |>(read: Not a Number) instead. |> |>Now drop the sind(argument) from the write command, |>i.e. change the line to |> |> write(6,*)count,argument,cosd(argument) |> |>and run the program again. Now, when 90. degrees are reached, |>the cosd() correctly returns zero. |> |>Am I missing something here or might this be a bug? Why should |>the result of the cosd() call depend on whether sind() is |>called afterwards or not? |> |>If you drop the do-loop and just set count to 4, cosd() correctly |>returns zero whether the sind() is present in the write command |>or not. Now what's the difference between count being explicitly |>set to 4 or by being incremented step by step and finally reaching |>4 in a do-loop? |> |>Now change the declaration of argument from real*4 to real*8 |>and cosd() and sind() to dcosd() and dsind() resp. |>dcosd() returns NaN as well. |> |>Now try real*16, qcosd() and qsind() and....yea! You finally get |>zero even though the float() call should return a real*4 value |>which is then added to a real*16 value. |> |>Surprisingly, the problem is gone as soon as I compile the code |>with the /nooptimize qualifier (looks like an optimizer-bug, |>doesn't it?). No, it's not. It's a Run-Time Library bug in OpenVMS AXP V6.1. The reason it matters whether or not you also call sind is that the compiler uses an optimized entry point that computes both the sin and cos in a single call. This routine has a bug in in when the argument is 90.0. If you contact your Digital software support center, they will get you a correction as soon as it is available. In the meantime, use /NOOPT as a workaround. -- Steve Lionel Mail: lionel@quark.enet.dec.com DEC Fortran Development WWW: http://www.digital.com/info/slionel.html Digital Equipment Corporation 110 Spit Brook Road, ZKO2-3/N30 Nashua, NH 03062-2698 "Free advice is worth every cent" For a summary of Digital's Internet services, send mail to info@digital.com