43 mpfr_init2(b, std::numeric_limits<FloatNum>::digits);
44 mpfr_init2(x, std::numeric_limits<FloatNum>::digits);
45 mpfr_init2(y, std::numeric_limits<FloatNum>::digits);
46 mpfr_set_d(b, base, GMP_RNDN);
47 mpfr_set_d(x, base > 1.0 ? exponent.
min() : exponent.
max(), GMP_RNDN);
48 mpfr_pow(y, b, x, GMP_RNDD);
49 FloatNum lower = mpfr_get_d(y, GMP_RNDD);
50 mpfr_set_d(x, base > 1.0 ? exponent.
max() : exponent.
min(), GMP_RNDN);
51 mpfr_pow(y, b, x, GMP_RNDU);
52 FloatNum upper = mpfr_get_d(y, GMP_RNDU);
65 FloatNum lower = std::numeric_limits<FloatNum>::infinity();
68 mpfr_init2(x, std::numeric_limits<FloatNum>::digits);
69 mpfr_init2(y, std::numeric_limits<FloatNum>::digits);
70 mpfr_init2(q, std::numeric_limits<FloatNum>::digits);
73 for (
int i=0; i<2; i++) {
74 mpfr_set_d(x, n[i], GMP_RNDN);
75 for (
int j=0; j<2; j++) {
76 mpfr_set_d(y, d[j], GMP_RNDN);
77 mpfr_div(q, x, y, GMP_RNDD);
78 lower = std::min(lower, mpfr_get_d(q, GMP_RNDD));
79 mpfr_div(q, x, y, GMP_RNDU);
80 upper = std::max(upper, mpfr_get_d(q, GMP_RNDU));
94 template<
class A,
class B>
99 template<
class A,
class B>
116 template<
class A,
class B>
121 template<
class A,
class B>
124 return new (home)
Exp<A,B>(home,*
this);
127 template<
class A,
class B>
143 template<
class A,
class B>
149 template<
class A,
class B>
166 template<
class A,
class B>
172 template<
class A,
class B>
175 return new (home)
Pow<A,B>(home,*
this);
178 template<
class A,
class B>
Base-class for both propagators and branchers.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
friend FloatVal min(const FloatVal &x, const FloatVal &y)
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
virtual Actor * copy(Space &home)
Create copy during cloning.
Exp(Space &home, Exp &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, FloatNum base, A x0, B x1)
Post propagator for .
Pow(Space &home, Pow &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Create copy during cloning.
Home class for posting propagators
MixBinaryPropagator(Space &home, MixBinaryPropagator &p)
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
int ModEventDelta
Modification event deltas.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
double FloatNum
Floating point number base type.
Transcendental propagators
FloatVal fixed_base_log(FloatNum base, const FloatVal &value)
FloatVal fixed_base_pow(FloatNum base, const FloatVal &exponent)
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Gecode toplevel namespace
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
@ ES_NOFIX
Propagation has not computed fixpoint.