summaryrefslogtreecommitdiff
path: root/nbtheory.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-03-08 15:55:53 -0500
committerJeffrey Walton <noloader@gmail.com>2017-03-08 15:55:53 -0500
commit2416c0eaf558060d93b8d9cc726c75f60cf28c5c (patch)
tree27077bf74fcee7f6174e8cdb9ce591ce98fcd6f1 /nbtheory.cpp
parenta72fdedfa768eed9fb5ecf66c4e30db793194648 (diff)
downloadcryptopp-git-2416c0eaf558060d93b8d9cc726c75f60cf28c5c.tar.gz
Switch to <cmath> and standard math routines
Diffstat (limited to 'nbtheory.cpp')
-rw-r--r--nbtheory.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/nbtheory.cpp b/nbtheory.cpp
index 8383d91c..010f8e14 100644
--- a/nbtheory.cpp
+++ b/nbtheory.cpp
@@ -11,8 +11,8 @@
#include "smartptr.h"
#include "misc.h"
-#include <math.h>
#include <vector>
+#include <cmath>
#ifdef _OPENMP
# include <omp.h>
@@ -528,7 +528,7 @@ Integer MaurerProvablePrime(RandomNumberGenerator &rng, unsigned int bits)
const unsigned margin = bits > 50 ? 20 : (bits-10)/2;
double relativeSize;
do
- relativeSize = pow(2.0, double(rng.GenerateWord32())/0xffffffff - 1);
+ relativeSize = std::pow(2.0, double(rng.GenerateWord32())/0xffffffff - 1);
while (bits * relativeSize >= bits - margin);
Integer a,b;
@@ -1023,14 +1023,14 @@ unsigned int FactoringWorkFactor(unsigned int n)
// extrapolated from the table in Odlyzko's "The Future of Integer Factorization"
// updated to reflect the factoring of RSA-130
if (n<5) return 0;
- else return (unsigned int)(2.4 * pow((double)n, 1.0/3.0) * pow(log(double(n)), 2.0/3.0) - 5);
+ else return (unsigned int)(2.4 * std::pow((double)n, 1.0/3.0) * std::pow(std::log(double(n)), 2.0/3.0) - 5);
}
unsigned int DiscreteLogWorkFactor(unsigned int n)
{
// assuming discrete log takes about the same time as factoring
if (n<5) return 0;
- else return (unsigned int)(2.4 * pow((double)n, 1.0/3.0) * pow(log(double(n)), 2.0/3.0) - 5);
+ else return (unsigned int)(2.4 * std::pow((double)n, 1.0/3.0) * std::pow(std::log(double(n)), 2.0/3.0) - 5);
}
// ********************************************************