8f2fe273ea
This commit allows us to build Lean without the pthread dependency. It is also useful if we want to implement multi-threading on top of Boost. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
32 lines
798 B
C++
32 lines
798 B
C++
/*
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Soonho Kong
|
|
*/
|
|
#include <cmath>
|
|
#include "util/thread.h"
|
|
#include "util/numerics/numeric_traits.h"
|
|
#include "util/numerics/double.h"
|
|
|
|
namespace lean {
|
|
|
|
static LEAN_THREAD_LOCAL mpfr_rnd_t g_rnd;
|
|
void set_double_rnd(bool plus_inf) {
|
|
g_rnd = plus_inf ? MPFR_RNDU : MPFR_RNDD;
|
|
}
|
|
|
|
mpfr_rnd_t get_double_rnd() {
|
|
return g_rnd;
|
|
}
|
|
|
|
void double_power(double & v, unsigned k) { v = std::pow(v, k); }
|
|
void double_abs(double & v) { v = std::abs(v); }
|
|
void double_ceil(double & v) { v = std::ceil(v); }
|
|
void double_floor(double & v) { v = std::floor(v); }
|
|
|
|
static double g_zero = 0.0;
|
|
double const & numeric_traits<double>::zero() {
|
|
return g_zero;
|
|
}
|
|
};
|