#include <stdint.h>
#include <assert.h>
#include <climits>
#include <cmath>
|
| namespace | MathUtils |
| | Math utility class. Note that the test() routine should return true for all implementations.
|
| |
|
| int | MathUtils::round_int (double x) |
| | Round to nearest integer. This routine does fast rounding to the nearest integer. In the case (k + 0.5 for any integer k) we round up to k+1, and in all other instances we should return the nearest integer. Thus, { -1.5, -0.5, 0.5, 1.5 } is rounded to { -1, 0, 1, 2 }. It preserves the property that round(k) - round(k-1) = 1 for all doubles k. More...
|
| |
| int | MathUtils::truncate_int (double x) |
| | Truncate to nearest integer. This routine does fast truncation to an integer. It should simply drop the fractional portion of the floating point number. More...
|
| |
| int64_t | MathUtils::abs (int64_t a) |
| |
| unsigned | MathUtils::bitcount (unsigned v) |
| |
| void | MathUtils::hack () |
| |
| template<typename FloatT > |
| bool | MathUtils::FloatEquals (FloatT f1, FloatT f2, FloatT maxDelta) |
| |