Skip to content
Snippets Groups Projects
Commit b237fb64 authored by Jorge Peña Queralta's avatar Jorge Peña Queralta
Browse files

cpp pow

parent 80c6d943
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -58,7 +58,7 @@ long double extract_12_digits ...@@ -58,7 +58,7 @@ long double extract_12_digits
return k; return k;
} }
int POW void POW
() { () {
int64_t iterations = 100000; // for each nonce int64_t iterations = 100000; // for each nonce
...@@ -68,9 +68,10 @@ int POW ...@@ -68,9 +68,10 @@ int POW
int repeat = 2; int repeat = 2;
int nSeq = nFunctions*repeat; int nSeq = nFunctions*repeat;
long double last_avg = 5e+11; // Assume avg was correct to get a std_dev // long double last_avg = 5e+11; // Assume avg was correct to get a std_dev
long double hash = 1.234567801123456e76; // sha256 of (nonce + prev block hash) long double hash = 1.234567801123456e76; // sha256 of (nonce + prev block hash)
long double k, k2, intpart, fractpart, averg, std_dev; long double k, k2, intpart, fractpart;
// long double averg, std_dev;
int64_t sysTime; int64_t sysTime;
int n, seq, function_count, temp; int n, seq, function_count, temp;
...@@ -82,7 +83,7 @@ int POW ...@@ -82,7 +83,7 @@ int POW
// Get the significand in base 2. Range is 0.5000 to 0.9999 // Get the significand in base 2. Range is 0.5000 to 0.9999
// k is significand & n => 2^n exponent // k is significand & n => 2^n exponent
n; // n;
k = frexp (hash , &n); k = frexp (hash , &n);
// The above did not give me a smooth "random" distribution but // The above did not give me a smooth "random" distribution but
// the following seemed to fix it by throwing away top 2 digits. // the following seemed to fix it by throwing away top 2 digits.
...@@ -191,8 +192,8 @@ int POW ...@@ -191,8 +192,8 @@ int POW
cout << sysTime << "us, output k=" << k << endl; cout << sysTime << "us, output k=" << k << endl;
averg=0; // averg=0;
std_dev=0; // std_dev=0;
// output[nonce] = sysTime; // output[nonce] = sysTime;
} // next nonce } // next nonce
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment