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);
51 if (frac < 0 || frac == 1.) {
54 const int base = (int)frac;
55 const int resolution = 1000;
56 const int intFrac = (int)floor((frac - base) * resolution + 0.5);
58 if (((loaded % resolution) * intFrac) % resolution < intFrac) {
int getScalingQuota(double frac, int loaded)
Returns the number of instances of the current object that shall be emitted given the number of loade...
double truncate(double x, int fractionBits)
discrds mantissa bits beyond the given number
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 gWeightsWalkOppositeFactor
bool gDebugFlag1
global utility flags for debugging