Print

Print


Curious

This is the output I get

K:\Documents and Settings\Ian>ifort test.f
Intel(R) Fortran Compiler for 32-bit applications, Version 8.1    Build
20040802
Z Package ID: w_fc_p_8.1.021
Copyright (C) 1985-2004 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 7.00.9466
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
-entry:mainCRTStartup
test.obj

K:\Documents and Settings\Ian>test
 Strange : random numbers are the same
   0.0002472573
   0.9353569401
   0.6148786582
   0.8077240475

Are you running the latest version of the compiler?
See the details in the compile above for the
Version I'm using.

Cheers

Ian Chivers
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of
Xiaogang Wang
Sent: 06 November 2004 15:16
To: [log in to unmask]
Subject: error of rand with intel fortran compiler

Hi,

The old random number function rand() always gives the same number under all
the intel fortran compilers I tested (7.1, 8.0, 8.1). See the simple test
code below.


Is this a known ifc bug? Thanks.

Xiaogang

====================
c     compiled with
c     ifort test.f -Vaxlib
      program main
      implicit double precision (a-h,o-z)
      dimension a(4)

      write(*,*)'Strange : random numbers are the same'
      iseed=11
      call srand(iseed)
      do i=1,4
        a(i)=rand()
c        if the following line is added, it works again.
c        write(*,*)a(i)
      end do
      write(*,'(f15.10)')a(1:4)

      end
===========
Output:
 Strange : random numbers are the same
   0.0002472573
   0.0002472573
   0.0002472573
   0.0002472573


--
------------------------------------------------
Dr Xiaogang Wang
Departement de chimie
Universite de Montreal
C.P. 6128, succursale Centre-ville
Montreal (Quebec) H3C 3J7

Tel. (514) 3436111 ext 3947 (office)
FAX  (514) 3437586 (office)
e-mail: [log in to unmask]
homepage: http://www.esi.umontreal.ca/~wangx
------------------------------------------------