39 return ceil(x * (1 << fractionBits)) / (1 << fractionBits);
43 const double x2 = x * (1 << fractionBits);
44 const double rounded = x2 < 0 ? ceil(x2 - 0.5) : floor(x2 + 0.5);
45 return rounded / (1 << fractionBits);
bool gDebugFlag1
global utility flags for debugging
int gPrecision
the precision for floating point outputs
double gWeightsRandomFactor
double roundBits(double x, int fractionBits)
round to the given number of mantissa bits beyond the given number
double truncate(double x, int fractionBits)
discrds mantissa bits beyond the given number