Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

Unexpected behaviour of MERGE function

Drapatow__Thomas
Beginner
332 Views

I have a weird problem with the merge function. It works fine most of times, but one call produces an unexpected result. It looks like this:

The problematic call should replace every value of P_GES thats smaller than 1d-10 with 1d-10 to catch zeros and negative values. It does so very well, except for the last entries in the array P_GES. As you can see, as the breakpoint is active, the values in P_GES are all very big:

 

so MERGE should not do anything. Howevery, if I stop the code just one line later:

P_GES looks like this

As you can see, it didnt even replace it with 1d-10, it sometimes chooses completely random values. How can that happen? It always happens for the last entries of this particular array and works fine for all my 1D-Arrays. I also havent seen the problem for the next call with P_GES_I.
P_GES is of KIND(REAL=8), i am using windows 10, Intel Parallel Studio 2018 Update 1 and Visual Studio Community 2017, 15.0.0.+26228.52


 

0 Kudos
1 Reply
andrew_4619
Honored Contributor II
332 Views

why would it replace? 1.0 is > than 1d-10

 

0 Kudos
Reply