MCPcopy Create free account
hub / github.com/Gecode/gecode / solution

Method solution

test/float/arithmetic.cpp:325–332  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

323 : Test("Arithmetic::Sqrt::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
324 /// %Test whether \a x is solution
325 virtual MaybeType solution(const Assignment& x) const {
326 switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
327 case MT_FALSE: return MT_FALSE;
328 case MT_MAYBE: return MT_MAYBE;
329 default:
330 return eq(sqrt(x[0]), x[1]);
331 }
332 }
333 /// Extend assignment \a x
334 virtual bool extendAssignment(Assignment& x) const {
335 Gecode::FloatVal d = sqrt(abs(x[0]));

Callers

nothing calls this directly

Calls 1

sqrtFunction · 0.50

Tested by

no test coverage detected