Skip to content

Instantly share code, notes, and snippets.

@plus7
Created April 10, 2011 10:02
Show Gist options
  • Save plus7/912206 to your computer and use it in GitHub Desktop.
Save plus7/912206 to your computer and use it in GitHub Desktop.
PHPに移植するもっともスマートな方法は…
public double vranlc(double n, double x, double a, double y[],int offset){
long Lx = (long)x;
long La = (long)a;
for(int i=0;i<n;i++){
Lx = (Lx*La) & (i246m1); //long i246m1 = pow(2, 46) - 1
y[offset+i] = (double)(d2m46* Lx); //double d2m46 = pow(0.5, 46)
}
return (double) Lx;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment