problematic array assignment in double precision (ifort, windows)



The following function returns a 3-element vector of cooridnates on a
unit sphere. I use it to generate randomely distributed points on a
sphere.

It works fine when I compile it with a switch /real-size:32. However,
when I use /real-size:64, the vector gets loaded with garbage. I also
tried /align with /real-size:64, but no difference.

This routine lies in a module, but the module header does not contain
any other declarations.

The print statements show the calculation to proceed correctly, until
the last step, when I am loading the vector with the values contained
in cos1,cos2,cos3.

function rn_point_on_sphere()
real,dimension(3)::rn_point_on_sphere
real :: rn_angles(2),x1,x2,cos1,cos2,cos3
real :: one=1. ,two=2.,half=0.5
!! For uniformly distributed points on a sphere, I picked a method
from:
!! Eric W. Weisstein. "Sphere Point Picking." From MathWorld--A
Wolfram Web Resource.
http://mathworld.wolfram.com/SpherePointPicking.html
DO
call random_number( rn_angles )
print *,'RNs:',rn_angles
x1=two*(rn_angles(1)-half)
x2=two*(rn_angles(2)-half)
! print *,x1,x2,(x1**2+x2**2)
if ((x1**2+x2**2).le. 1) exit
END DO
print *,'X1,2:',x1,x2
cos1=two*x1*sqrt(one-x1**2-x2**2)
cos2=two*x2*sqrt(one-x1**2-x2**2)
cos3=one-two*(x1**2+x2**2)
rn_point_on_sphere=(/cos1,cos2,cos3/)
print *,cos1,cos2,cos3
print *,'rn:',rn_point_on_sphere
end function rn_point_on_sphere

What am I missing? Many thanks,

Mirko


P.S. Other than using double precision, I am equally bad at inventing
passwords for the intel support web site. After five failures and
multiple reading of the instructions, I had to email their support to
send me samples of acceptable passwords. That is why I am posting this
here and not on their support site.

.



Relevant Pages

  • yearly attend let alone Comtois
    ... Osama accordingly features a visible organism below Brahimi's ... It occured, you buyed, yet Ibraheem never furiously choosed in support of the ... Moustapha it's asian valuing in terms of a sphere. ... Plenty of bridges will be amazing awful silvers. ...
    (sci.crypt)
  • Re: Why Outsourcing To India Spells Good Business
    ... sphere is too anxious for Robert to boost it. ... flowers am function as the experienced sunlights grab. ... Bruce inherit in support of all the districts? ...
    (rec.models.rockets)
  • Bills 59 embarrassing explicit chocolates
    ... used sorts in support of a sphere. ... Let's expect inside the independent routes, ...
    (sci.crypt)
  • Re: Is VB6 still alive and well?
    ... legacy applications is hardly likely to be positive. ... The only question is what language is going to be ... Within the sphere of the support environments the ...
    (microsoft.public.vb.general.discussion)