Talk:Pseudo-random numbers/PCG32: Difference between revisions

→‎Help needed: new section
(→‎Help needed: new section)
Line 48:
:::::::: Writing an alternative draft is, of course, the only constructive use of these divergences. I might often feel puzzled by the sheer unreliability and stylistic incoherence of some variants touchingly announced to be 'idiomatic', but these things don't need to be said.
:::::::: Variant drafts are much more useful and interesting Rosetta commentaries, and much more eloquent too. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 06:57, 16 August 2020 (UTC)
 
== Help needed ==
 
I am trying to translate the JAVA Program to REXX.
 
Can anyone explain this stone in my way (the different values of t5)?
 
These are a few lines of a JAVA program
<pre>
long t1=(shiftedx >>> rotx); System.out.printf("%nt1=%d",t1);
int t2=(~rotx); System.out.printf("%nt2=%d",t2);
int t3=(t2+1); System.out.printf("%nt3=%d",t3);
int t4=(t3 & 31); System.out.printf("%nt4=%d",t4);
System.out.printf("%nshiftedx=%d",shiftedx);
System.out.printf("%nlong t5=(shiftedx << t4);");
long t5=(shiftedx << t4); System.out.printf("%nt5=%d",t5);
long t7=(t1|t5); System.out.printf("%nt7=%d",t7);
int t8=(int) t7; System.out.printf("%nt8=%d",t8);
 
running this program shows this in the output:
 
t4=20
shiftedx=-293022013
long t5=(shiftedx << t4);
t5=1815085056
 
When I try this in a small program,
 
long n=-293022013;
int s=20;
long t5=(n<<s);
System.out.printf("%nn=%d",n);
System.out.printf("%nt5=%d",t5);
I get
n=-293022013
t5=-307255850303488
</pre>
--Walter Pachl 08:22, 27 February 2021 (UTC)
2,295

edits