meditationatae

Just another WordPress.com site

cat newreadtest28a.c

#include <stdio.h>
#include <quadmath.h>

int smallp[1000000];
int main(void)
{
int j;
long low, high, count, lastprime;
__float128 datalog[1000];
char buf1[100];
char buf2[100];
__float128 r;
__float128 epsilon;
__float128 var01;
__float128 var02;
__float128 var03;
__float128 var04;
__float128 var05;
int power2;
long p;
long smallprime;
__float128 fsmallprime;
__float128 deltasumlog;
__float128 sumlog;
int k;
FILE *in;
FILE *in1;
FILE *in2;

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(buf2, NULL);
if(j == 0)
{
datalog[j] = r;
}
else
{
datalog[j] = datalog[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);
deltasumlog = (__float128) 0;

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;
deltasumlog = deltasumlog + (var05 – 1.0Q)*logq(fsmallprime);
}

sumlog = datalog[j] + deltasumlog;

printf(“sumlog = %.25Qf\n”, sumlog);
}
fclose(in1);

return 0;
}

Advertisements

Written by meditationatae

May 31, 2015 at 6:03 pm

Posted in History

%d bloggers like this: