예제 #1
0
//! Round output of an operation.
//! \param roundUnderOverflow Can +/-inf rounded to min/max representable;
//!							  should be false if any of operands was inf, true otherwise.
Interval FloatFormat::roundOut (const Interval& x, bool roundUnderOverflow) const
{
	Interval ret = x.nan();

	if (!x.empty())
		ret |= Interval(roundOut(x.lo(), false, roundUnderOverflow),
						roundOut(x.hi(), true, roundUnderOverflow));

	return ret;
}
void Matrix<double>::create(int w, int h, double value)
{
	if (w==0 || h==0)
	{
		width = w;
		height = h;
		freeMemory(); //pData = 0;
						// Modified by Congkai, only pData may cause memory leak;
		return;
	}
	if((w != width || h != height || pData == NULL))
	{
		freeMemory();
		int size = roundOut(w*h);
#ifdef	_MSC_VER
	    pData = (double*)_aligned_malloc(size*sizeof(double), 16);
#else
		pData = (double*)memalign(16, size*sizeof(double));
#endif
		width = w;
		height = h;
	}
	set(value);
}