2011-01-18 02:02:56 +03:00
|
|
|
#include "mathc99.h"
|
|
|
|
|
2011-01-18 02:52:45 +03:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <algorithm>
|
|
|
|
|
2013-07-28 15:42:35 +04:00
|
|
|
double trunc(double a) {
|
|
|
|
return (a >= 0) ? floor(a) : ceil(a);
|
|
|
|
}
|
|
|
|
|
2011-01-18 02:52:45 +03:00
|
|
|
double round(double a) {
|
2013-07-28 15:42:35 +04:00
|
|
|
return a < 0 ? ceil(a - 0.5f) : floor(a + 0.5f);
|
2011-01-18 02:52:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
float fmin(float a, float b) {
|
|
|
|
return std::min(a,b);
|
2011-01-18 02:02:56 +03:00
|
|
|
}
|
2011-01-18 02:52:45 +03:00
|
|
|
|
|
|
|
float fmax(float a, float b) {
|
|
|
|
return std::max(a,b);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|