Add numerics/numeric_traits.cpp
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
03802b2e4d
commit
d3f5e34d08
1 changed files with 24 additions and 0 deletions
24
src/numerics/numeric_traits.cpp
Normal file
24
src/numerics/numeric_traits.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
|
||||
Author: Leonardo de Moura
|
||||
*/
|
||||
#include <cfenv>
|
||||
#include <cmath>
|
||||
#include "numeric_traits.h"
|
||||
|
||||
namespace lean {
|
||||
|
||||
void set_processor_rounding(bool plus_inf) {
|
||||
if (plus_inf)
|
||||
std::fesetround(FE_UPWARD);
|
||||
else
|
||||
std::fesetround(FE_DOWNWARD);
|
||||
}
|
||||
|
||||
void double_power(double & v, unsigned k) {
|
||||
v = std::pow(v, k);
|
||||
}
|
||||
|
||||
};
|
Loading…
Reference in a new issue