meditationatae

Just another WordPress.com site

cat newreadtest38a.c

[david2@localhost eratosthenes10]$ pwd
/home/david2/eratosthenes10

cat newreadtest38a.c
#include <stdio.h>
#include <quadmath.h>

int smallp[1000000];
int main(void)
{
int j;
long low, high, count, lastprime;
__float128 sigmarelative[1000];
char buf1[100];
char buf2[100];
__float128 r;
__float128 epsilon;
__float128 var01;
__float128 var02;
__float128 var03;
__float128 var04;
__float128 var05;
__float128 var06;
__float128 var07;
int power2;
int exponent;
long p;
long smallprime;
__float128 fsmallprime;
__float128 deltasigmarelative;
__float128 sigma;
__float128 f1;
int k;
int m;
FILE *in;
FILE *in1;
FILE *in2;
f1 = (__float128) 1;

in = fopen(“/home/david2/eratosthenes10/test_data”, “r”);

in1 = fopen(“/home/david2/eratosthenes10/lastprimes.txt”, “r”);

in2= fopen(“/home/david2/eratosthenes10/primes1meg02a_tmp.txt”, “r”);
for(j=0; j<1000; j++)
{
fscanf(in, “%ld”, &low);
fscanf(in, “%ld”, &high);
fscanf(in, “%ld”, &count);
fscanf(in, “%s”, &buf1);
fscanf(in, “%s”, &buf2);
r = strtoflt128(buf1, NULL);
if(j == 0)
{
sigmarelative[j] = r;
}
else
{
sigmarelative[j] = sigmarelative[j-1]*r;
}

fscanf(in, “%ld”, &lastprime);
}

fclose(in);
for(j=0; j<1000000; j++)
{
fscanf(in2, “%d”, &smallp[j]);
}

fclose(in2);

for(j=0; j<1000; j++)
{
fscanf(in1, “%ld”, &p);

epsilon = logq(1.0Q + 1.0Q/((__float128) p))/logq( ((__float128) p) );
printf(“p = %ld “, p);
printf(“epsilon = %.30Qe “, epsilon);
deltasigmarelative = f1;

for(k=0; k<1000000;k++)
{
smallprime = smallp[k];

fsmallprime = (__float128) smallprime;

var01 = expq((1.0Q+epsilon)*logq(fsmallprime))-1.0Q;
var02 = expq(epsilon*logq(fsmallprime))-1.0Q;
var03 = logq(var01/var02);
var04 = var03/logq(fsmallprime);
var05 = floorq(var04) – 1.0Q;
exponent = (int) var05;
var06 = f1;

for(m =0; m< exponent; m++)
{
var06 = f1 + var06/fsmallprime ;
}

var07 = var06/(f1 + f1/fsmallprime);

deltasigmarelative = deltasigmarelative*var07;
// deltasumlog = deltasumlog + (var05 – 1.0Q)*logq(fsmallprime);
}

sigma = sigmarelative[j]*deltasigmarelative;

printf(“sigmarel = %.30Qf\n”, sigma);
}
fclose(in1);

return 0;
}

Advertisements

Written by meditationatae

June 1, 2015 at 5:48 am

Posted in History

%d bloggers like this: