Hi all,
I have been using the vdrnggaussian routine to generate normally distributed random numbers. Once in a while however, I get the following error:
forrtl: error (73): floating divide by zero
I have verified this occurs within the call to vdrnggaussian using write statements before and after. Here is my code:
SUBROUTINE reac_diff
! MKL_VSL module included in other routine.
USE MKL_VSL
USE MKL_VSL_TYPE
...
TYPE(VSL_STREAM_STATE) :: fstream
INTEGER, PARAMETER :: Ne=20480
INTEGER :: ferror, rdSeed !rdSeed randomly generated from 1 to 10,000
REAL :: rdmean=0., rdstd=1.
REAL, DIMENSION(Ne) :: frand
ferror=vslnewstream( fstream,VSL_BRNG_MT19937, rdSeed )
WRITE(*,*) 'in vdr'
ferror = vdrnggaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER,fstream,Ne,frand,rdmean,rdstd ) !error occurs in here
WRITE(*,*) 'out vdr'
...
END SUBROUTINE reac_diff
I compile with the -r8 flag so the reals are double precision. Compiling with -logo gives:
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.0.080 Build 20130728
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY
Intel(R) Fortran 14.0-1565
GNU ld (GNU Binutils for Ubuntu) 2.22
and using MKL_GET_VERSION_STRING gives
Intel(R) Math Kernel Library Version 11.1.0 Product Build 20130711 for Intel(R)
64 architecture applications
Any ideas how to prevent the error?