*/
Real Bernstein(int k, int n, const Real & u)
{
- return Real(BinomialCoeff(n, k)) * pow(u, k) * pow(Real(1.0) - u, n-k);
+ return Real(BinomialCoeff(n, k)) * Power(u, k) * Power(Real(1.0) - u, n-k);
}
}
T Q;
};
-inline Rational<int64_t> pow(const Rational<int64_t> & a, const Rational<int64_t> & b)
-{
- //TODO:Implement properly
- int64_t P = std::pow((double)a.P, b.ToDouble());
- int64_t Q = std::pow((double)a.Q, b.ToDouble());
- return Rational<int64_t>(P, Q);
-}
"single",
"double",
"long double",
- "single [fast2sum]", //TODO REMOVE DOESN'T DO ANYTHING USEFUL
+ "VFPU",
"Rational<int64_t>",
"Rational<Arbint>"
};
typedef Rational<ARBINT> Real;
inline float Float(const Real & r) {return (float)r.ToDouble();}
inline double Double(const Real & r) {return r.ToDouble();}
- inline Rational<ARBINT> pow(const Rational<ARBINT> & a, const Rational<ARBINT> & b)
- {
- ARBINT P(std::pow(static_cast<double>(a.P), b.ToDouble()));
- ARBINT Q(std::pow(static_cast<double>(a.Q), b.ToDouble()));
- return Rational<ARBINT>(P,Q);
- }
+
#else
#error "Type of Real unspecified."
#endif //REAL
inline double Double(float f) {return (double)f;}
inline double Double(double f) {return (double)f;}
inline double Double(long double f) {return (double)(f);}
+
+ inline Real Power(const Real & a, int n)
+ {
+ if (n < 0)
+ {
+ return Power(Real(1)/a, -n);
+ }
+ Real r(1);
+ for (int i = 0; i < n; ++i)
+ r *= a;
+ return r;
+ }
+
}
#endif //_REAL_H
float m_value;
};
-
- inline Float pow(const Float & a, const Float & b)
- {
- return Float(pow(a.m_value, b.m_value));
- }
}
#endif //_VFPU_H
Rect old_bounds = m_bounds;
if (node == QUADTREE_EMPTY) return;
if (!remaining_depth) return;
- Debug("Rendering QT node %d, (objs: %d -- %d)\n", node, m_document.GetQuadTree().nodes[node].object_begin, m_document.GetQuadTree().nodes[node].object_end);
+ //Debug("Rendering QT node %d, (objs: %d -- %d)\n", node, m_document.GetQuadTree().nodes[node].object_begin, m_document.GetQuadTree().nodes[node].object_end);
RenderRange(width, height, m_document.GetQuadTree().nodes[node].object_begin, m_document.GetQuadTree().nodes[node].object_end);
m_bounds = TransformToQuadChild(old_bounds, QTC_TOP_LEFT);