Mail Archives: cygwin/1996/10/14/00:46:44
Please see attached function:
double rand_u(int stream) {
long zi,lowprd,hi31;
long end_res;
extern long zrng[];
zi=zrng[stream];
/* printf("ZI: %d\n",zi);*/
lowprd= (zi & 65535) * MULT1;
printf("LOWPRD:%d\n",lowprd);
hi31= (zi >> 16) * MULT1 + (lowprd >> 16);
printf("HI31:%d\n",hi31);
zi = ( (lowprd & 65535) -MODLUS) + ( (hi31 & 32767) << 16 )+(hi31 >>15);
printf("ZI: %d\n",zi);
if (zi <0) zi+=MODLUS;
lowprd = (zi & 65535) *MULT2;
hi31= (zi >> 16) * MULT2 + (lowprd >> 16);
zi = ( (lowprd & 65535) -MODLUS) + ( (hi31 & 32767) << 16 )+(hi31 >>15);
if (zi <0) zi+=MODLUS;
zrng[stream]=zi;
printf("ZI: %d\n",zi);
end_res= (( (zi >> 7 | 1) +1) / 16777216.0);
printf("%d\n",end_res);
return (double) end_res;
}
For some reason this function works on Linux, BSD and Suns using gcc
and does not work in gcc-win32.
All of the files compile fine with no errors on all systems.
It is the last line that end_res is assigned to that returns a negative value
in long which is not possible since zi is positive and the divider is
positive.
Any info will be appreciated please email replys personally to
akyol AT stanford DOT edu
mailto:akyol AT stanford DOT edu
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -